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

Unified Diff: content/browser/gamepad/gamepad_service_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 | « content/browser/gamepad/gamepad_service.cc ('k') | content/browser/gamepad/gamepad_service_test_helpers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gamepad/gamepad_service_test_helpers.h
diff --git a/content/browser/gamepad/gamepad_service_test_helpers.h b/content/browser/gamepad/gamepad_service_test_helpers.h
new file mode 100644
index 0000000000000000000000000000000000000000..273a42d321404103e6e1fc0ae619ed96961cae35
--- /dev/null
+++ b/content/browser/gamepad/gamepad_service_test_helpers.h
@@ -0,0 +1,38 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// 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_SERVICE_TEST_HELPERS_H_
+#define CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_TEST_HELPERS_H_
+
+#include "base/macros.h"
+#include "device/gamepad/gamepad_test_helpers.h"
+#include "third_party/WebKit/public/platform/WebGamepads.h"
+
+namespace content {
+
+class GamepadService;
+
+// Constructs a GamepadService with a mock data source. This bypasses the
+// global singleton for the gamepad service.
+class GamepadServiceTestConstructor : public device::GamepadTestHelper {
+ public:
+ explicit GamepadServiceTestConstructor(const blink::WebGamepads& test_data);
+ ~GamepadServiceTestConstructor() override;
+
+ GamepadService* gamepad_service() { return gamepad_service_; }
+ device::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).
+ device::MockGamepadDataFetcher* data_fetcher_;
+
+ DISALLOW_COPY_AND_ASSIGN(GamepadServiceTestConstructor);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_TEST_HELPERS_H_
« no previous file with comments | « content/browser/gamepad/gamepad_service.cc ('k') | content/browser/gamepad/gamepad_service_test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698