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

Unified Diff: device/gamepad/gamepad_test_helpers.h

Issue 2081583002: Migrating majority of gamepad from content/browser/ to device/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final tweaks 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/gamepad/gamepad_standard_mappings_win.cc ('k') | device/gamepad/gamepad_test_helpers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/gamepad/gamepad_test_helpers.h
diff --git a/content/browser/gamepad/gamepad_test_helpers.h b/device/gamepad/gamepad_test_helpers.h
similarity index 66%
rename from content/browser/gamepad/gamepad_test_helpers.h
rename to device/gamepad/gamepad_test_helpers.h
index 4b44f2b7fb820bfd4ab26ffdb08df1a5793fce5c..7681bf9769458ebe1938f42901955bd05c0c9eca 100644
--- a/content/browser/gamepad/gamepad_test_helpers.h
+++ b/device/gamepad/gamepad_test_helpers.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_TEST_HELPERS_H_
-#define CONTENT_BROWSER_GAMEPAD_GAMEPAD_TEST_HELPERS_H_
+#ifndef DEVICE_GAMEPAD_GAMEPAD_TEST_HELPERS_H_
+#define DEVICE_GAMEPAD_GAMEPAD_TEST_HELPERS_H_
#include <memory>
@@ -11,10 +11,11 @@
#include "base/message_loop/message_loop.h"
#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
-#include "content/browser/gamepad/gamepad_data_fetcher.h"
+#include "device/gamepad/gamepad_data_fetcher.h"
+#include "device/gamepad/gamepad_shared_buffer.h"
#include "third_party/WebKit/public/platform/WebGamepads.h"
-namespace content {
+namespace device {
class GamepadService;
@@ -51,6 +52,22 @@ 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:
@@ -66,26 +83,6 @@ 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 content
+} // namespace device
-#endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_TEST_HELPERS_H_
+#endif // DEVICE_GAMEPAD_GAMEPAD_TEST_HELPERS_H_
« no previous file with comments | « device/gamepad/gamepad_standard_mappings_win.cc ('k') | device/gamepad/gamepad_test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698