OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/gamepad/gamepad_test_helpers.h" | 5 #include "content/browser/gamepad/gamepad_test_helpers.h" |
6 | 6 |
7 #include "base/system_monitor/system_monitor.h" | 7 #include "base/power_monitor/power_monitor.h" |
8 #include "content/browser/gamepad/gamepad_service.h" | 8 #include "content/browser/gamepad/gamepad_service.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 MockGamepadDataFetcher::MockGamepadDataFetcher( | 12 MockGamepadDataFetcher::MockGamepadDataFetcher( |
13 const WebKit::WebGamepads& test_data) | 13 const WebKit::WebGamepads& test_data) |
14 : test_data_(test_data), | 14 : test_data_(test_data), |
15 read_data_(false, false) { | 15 read_data_(false, false) { |
16 } | 16 } |
17 | 17 |
(...skipping 13 matching lines...) Expand all Loading... | |
31 return read_data_.Wait(); | 31 return read_data_.Wait(); |
32 } | 32 } |
33 | 33 |
34 void MockGamepadDataFetcher::SetTestData(const WebKit::WebGamepads& new_data) { | 34 void MockGamepadDataFetcher::SetTestData(const WebKit::WebGamepads& new_data) { |
35 base::AutoLock lock(lock_); | 35 base::AutoLock lock(lock_); |
36 test_data_ = new_data; | 36 test_data_ = new_data; |
37 } | 37 } |
38 | 38 |
39 GamepadTestHelper::GamepadTestHelper() { | 39 GamepadTestHelper::GamepadTestHelper() { |
40 #if defined(OS_MACOSX) | 40 #if defined(OS_MACOSX) |
41 base::SystemMonitor::AllocateSystemIOPorts(); | 41 base::PowerMonitor::AllocateSystemIOPorts(); |
vandebo (ex-Chrome)
2012/10/29 18:04:38
This probably isn't needed.
Hongbo Min
2012/10/30 14:33:47
Remove it now.
| |
42 #endif | 42 #endif |
43 system_monitor_.reset(new base::SystemMonitor); | |
44 } | 43 } |
45 | 44 |
46 GamepadTestHelper::~GamepadTestHelper() { | 45 GamepadTestHelper::~GamepadTestHelper() { |
47 } | 46 } |
48 | 47 |
49 GamepadServiceTestConstructor::GamepadServiceTestConstructor( | 48 GamepadServiceTestConstructor::GamepadServiceTestConstructor( |
50 const WebKit::WebGamepads& test_data) { | 49 const WebKit::WebGamepads& test_data) { |
51 data_fetcher_ = new MockGamepadDataFetcher(test_data); | 50 data_fetcher_ = new MockGamepadDataFetcher(test_data); |
52 gamepad_service_ = | 51 gamepad_service_ = |
53 new GamepadService(scoped_ptr<GamepadDataFetcher>(data_fetcher_)); | 52 new GamepadService(scoped_ptr<GamepadDataFetcher>(data_fetcher_)); |
54 } | 53 } |
55 | 54 |
56 GamepadServiceTestConstructor::~GamepadServiceTestConstructor() { | 55 GamepadServiceTestConstructor::~GamepadServiceTestConstructor() { |
57 delete gamepad_service_; | 56 delete gamepad_service_; |
58 } | 57 } |
59 | 58 |
60 } // namespace content | 59 } // namespace content |
OLD | NEW |