Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: device/gamepad/gamepad_test_helpers.h

Issue 2129003002: Refactored gamepad polling to support dynamic sources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit test issue and Mac XBoxDataFetcher constructor Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698