OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_TEST_HELPERS_H_ |
| 6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_TEST_HELPERS_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "device/gamepad/gamepad_test_helpers.h" |
| 10 #include "third_party/WebKit/public/platform/WebGamepads.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 class GamepadService; |
| 15 |
| 16 // Constructs a GamepadService with a mock data source. This bypasses the |
| 17 // global singleton for the gamepad service. |
| 18 class GamepadServiceTestConstructor : public device::GamepadTestHelper { |
| 19 public: |
| 20 explicit GamepadServiceTestConstructor(const blink::WebGamepads& test_data); |
| 21 ~GamepadServiceTestConstructor() override; |
| 22 |
| 23 GamepadService* gamepad_service() { return gamepad_service_; } |
| 24 device::MockGamepadDataFetcher* data_fetcher() { return data_fetcher_; } |
| 25 |
| 26 private: |
| 27 // Owning pointer (can't be a scoped_ptr due to private destructor). |
| 28 GamepadService* gamepad_service_; |
| 29 |
| 30 // Pointer owned by the provider (which is owned by the gamepad service). |
| 31 device::MockGamepadDataFetcher* data_fetcher_; |
| 32 |
| 33 DISALLOW_COPY_AND_ASSIGN(GamepadServiceTestConstructor); |
| 34 }; |
| 35 |
| 36 } // namespace content |
| 37 |
| 38 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_TEST_HELPERS_H_ |
OLD | NEW |