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 #ifndef DEVICE_GAMEPAD_GAMEPAD_TEST_HELPERS_H_ | 5 #ifndef DEVICE_GAMEPAD_GAMEPAD_TEST_HELPERS_H_ |
6 #define DEVICE_GAMEPAD_GAMEPAD_TEST_HELPERS_H_ | 6 #define DEVICE_GAMEPAD_GAMEPAD_TEST_HELPERS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // Data fetcher that returns canned data for the gamepad provider. | 22 // Data fetcher that returns canned data for the gamepad provider. |
23 class MockGamepadDataFetcher : public GamepadDataFetcher { | 23 class MockGamepadDataFetcher : public GamepadDataFetcher { |
24 public: | 24 public: |
25 // Initializes the fetcher with the given gamepad data, which will be | 25 // Initializes the fetcher with the given gamepad data, which will be |
26 // returned when the provider queries us. | 26 // returned when the provider queries us. |
27 explicit MockGamepadDataFetcher(const blink::WebGamepads& test_data); | 27 explicit MockGamepadDataFetcher(const blink::WebGamepads& test_data); |
28 | 28 |
29 ~MockGamepadDataFetcher() override; | 29 ~MockGamepadDataFetcher() override; |
30 | 30 |
| 31 GamepadSource source() override; |
| 32 |
31 // GamepadDataFetcher. | 33 // GamepadDataFetcher. |
32 void GetGamepadData(blink::WebGamepads* pads, | 34 void GetGamepadData(bool devices_changed_hint) override; |
33 bool devices_changed_hint) override; | |
34 | 35 |
35 // Blocks the current thread until the GamepadProvider reads from this | 36 // Blocks the current thread until the GamepadProvider reads from this |
36 // fetcher on the background thread. | 37 // fetcher on the background thread. |
37 void WaitForDataRead(); | 38 void WaitForDataRead(); |
38 | 39 |
39 // Blocks the current thread until the GamepadProvider reads from this | 40 // Blocks the current thread until the GamepadProvider reads from this |
40 // fetcher on the background thread and issued all callbacks related to the | 41 // fetcher on the background thread and issued all callbacks related to the |
41 // read on the client's thread. | 42 // read on the client's thread. |
42 void WaitForDataReadAndCallbacksIssued(); | 43 void WaitForDataReadAndCallbacksIssued(); |
43 | 44 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 private: | 80 private: |
80 // This must be constructed before the system monitor. | 81 // This must be constructed before the system monitor. |
81 base::MessageLoop message_loop_; | 82 base::MessageLoop message_loop_; |
82 | 83 |
83 DISALLOW_COPY_AND_ASSIGN(GamepadTestHelper); | 84 DISALLOW_COPY_AND_ASSIGN(GamepadTestHelper); |
84 }; | 85 }; |
85 | 86 |
86 } // namespace device | 87 } // namespace device |
87 | 88 |
88 #endif // DEVICE_GAMEPAD_GAMEPAD_TEST_HELPERS_H_ | 89 #endif // DEVICE_GAMEPAD_GAMEPAD_TEST_HELPERS_H_ |
OLD | NEW |