| Index: device/gamepad/gamepad_test_helpers.h
|
| diff --git a/device/gamepad/gamepad_test_helpers.h b/device/gamepad/gamepad_test_helpers.h
|
| index 14eb1767387da7b53eae085dac2f4a0e749625d1..b4f8c934780369c0b4bc07375a608dc8064ba2e1 100644
|
| --- a/device/gamepad/gamepad_test_helpers.h
|
| +++ b/device/gamepad/gamepad_test_helpers.h
|
| @@ -12,6 +12,7 @@
|
| #include "base/synchronization/lock.h"
|
| #include "base/synchronization/waitable_event.h"
|
| #include "device/gamepad/gamepad_data_fetcher.h"
|
| +#include "device/gamepad/gamepad_service.h"
|
| #include "device/gamepad/gamepad_shared_buffer.h"
|
| #include "third_party/WebKit/public/platform/WebGamepads.h"
|
|
|
| @@ -51,22 +52,6 @@ class MockGamepadDataFetcher : public GamepadDataFetcher {
|
| DISALLOW_COPY_AND_ASSIGN(MockGamepadDataFetcher);
|
| };
|
|
|
| -class MockGamepadSharedBuffer : public GamepadSharedBuffer {
|
| - public:
|
| - MockGamepadSharedBuffer();
|
| -
|
| - base::SharedMemory* shared_memory() override;
|
| - blink::WebGamepads* buffer() override;
|
| -
|
| - void WriteBegin() override;
|
| - void WriteEnd() override;
|
| -
|
| - private:
|
| - base::SharedMemory shared_memory_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(MockGamepadSharedBuffer);
|
| -};
|
| -
|
| // Base class for the other test helpers. This just sets up the system monitor.
|
| class GamepadTestHelper {
|
| public:
|
| @@ -82,6 +67,26 @@ class GamepadTestHelper {
|
| DISALLOW_COPY_AND_ASSIGN(GamepadTestHelper);
|
| };
|
|
|
| +// Constructs a GamepadService with a mock data source. This bypasses the
|
| +// global singleton for the gamepad service.
|
| +class GamepadServiceTestConstructor : public GamepadTestHelper {
|
| + public:
|
| + explicit GamepadServiceTestConstructor(const blink::WebGamepads& test_data);
|
| + ~GamepadServiceTestConstructor() override;
|
| +
|
| + GamepadService* gamepad_service() { return gamepad_service_; }
|
| + MockGamepadDataFetcher* data_fetcher() { return data_fetcher_; }
|
| +
|
| + private:
|
| + // Owning pointer (can't be a scoped_ptr due to private destructor).
|
| + GamepadService* gamepad_service_;
|
| +
|
| + // Pointer owned by the provider (which is owned by the gamepad service).
|
| + MockGamepadDataFetcher* data_fetcher_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(GamepadServiceTestConstructor);
|
| +};
|
| +
|
| } // namespace device
|
|
|
| #endif // DEVICE_GAMEPAD_GAMEPAD_TEST_HELPERS_H_
|
|
|