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 "content/browser/gamepad/gamepad_service.h" | 7 #include "content/browser/gamepad/gamepad_service.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
11 MockGamepadDataFetcher::MockGamepadDataFetcher( | 11 MockGamepadDataFetcher::MockGamepadDataFetcher( |
12 const blink::WebGamepads& test_data) | 12 const blink::WebGamepads& test_data) |
13 : test_data_(test_data), | 13 : test_data_(test_data), |
14 read_data_(false, false) { | 14 read_data_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
15 } | 15 base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
16 | 16 |
17 MockGamepadDataFetcher::~MockGamepadDataFetcher() { | 17 MockGamepadDataFetcher::~MockGamepadDataFetcher() { |
18 } | 18 } |
19 | 19 |
20 void MockGamepadDataFetcher::GetGamepadData(blink::WebGamepads* pads, | 20 void MockGamepadDataFetcher::GetGamepadData(blink::WebGamepads* pads, |
21 bool devices_changed_hint) { | 21 bool devices_changed_hint) { |
22 { | 22 { |
23 base::AutoLock lock(lock_); | 23 base::AutoLock lock(lock_); |
24 *pads = test_data_; | 24 *pads = test_data_; |
25 } | 25 } |
(...skipping 29 matching lines...) Expand all Loading... |
55 data_fetcher_ = new MockGamepadDataFetcher(test_data); | 55 data_fetcher_ = new MockGamepadDataFetcher(test_data); |
56 gamepad_service_ = | 56 gamepad_service_ = |
57 new GamepadService(std::unique_ptr<GamepadDataFetcher>(data_fetcher_)); | 57 new GamepadService(std::unique_ptr<GamepadDataFetcher>(data_fetcher_)); |
58 } | 58 } |
59 | 59 |
60 GamepadServiceTestConstructor::~GamepadServiceTestConstructor() { | 60 GamepadServiceTestConstructor::~GamepadServiceTestConstructor() { |
61 delete gamepad_service_; | 61 delete gamepad_service_; |
62 } | 62 } |
63 | 63 |
64 } // namespace content | 64 } // namespace content |
OLD | NEW |