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

Unified Diff: content/browser/gamepad/gamepad_test_helpers.cc

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
Index: content/browser/gamepad/gamepad_test_helpers.cc
diff --git a/content/browser/gamepad/gamepad_test_helpers.cc b/content/browser/gamepad/gamepad_test_helpers.cc
deleted file mode 100644
index d5121205b871f1a50d185ad7d118533c29fa8e0f..0000000000000000000000000000000000000000
--- a/content/browser/gamepad/gamepad_test_helpers.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// 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.
-
-#include "content/browser/gamepad/gamepad_test_helpers.h"
-
-#include "content/browser/gamepad/gamepad_service.h"
-
-namespace content {
-
-MockGamepadDataFetcher::MockGamepadDataFetcher(
- const blink::WebGamepads& test_data)
- : test_data_(test_data),
- read_data_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
- base::WaitableEvent::InitialState::NOT_SIGNALED) {}
-
-MockGamepadDataFetcher::~MockGamepadDataFetcher() {
-}
-
-void MockGamepadDataFetcher::GetGamepadData(blink::WebGamepads* pads,
- bool devices_changed_hint) {
- {
- base::AutoLock lock(lock_);
- *pads = test_data_;
- }
- read_data_.Signal();
-}
-
-void MockGamepadDataFetcher::WaitForDataRead() {
- return read_data_.Wait();
-}
-
-void MockGamepadDataFetcher::WaitForDataReadAndCallbacksIssued() {
- // The provider will read the data on the background thread (setting the
- // event) and *then* will issue the callback on the client thread. Waiting for
- // it to read twice is a simple way to ensure that it was able to issue
- // callbacks for the first read (if it issued one).
- WaitForDataRead();
- WaitForDataRead();
-}
-
-void MockGamepadDataFetcher::SetTestData(const blink::WebGamepads& new_data) {
- base::AutoLock lock(lock_);
- test_data_ = new_data;
-}
-
-GamepadTestHelper::GamepadTestHelper() {
-}
-
-GamepadTestHelper::~GamepadTestHelper() {
-}
-
-GamepadServiceTestConstructor::GamepadServiceTestConstructor(
- const blink::WebGamepads& test_data) {
- data_fetcher_ = new MockGamepadDataFetcher(test_data);
- gamepad_service_ =
- new GamepadService(std::unique_ptr<GamepadDataFetcher>(data_fetcher_));
-}
-
-GamepadServiceTestConstructor::~GamepadServiceTestConstructor() {
- delete gamepad_service_;
-}
-
-} // namespace content
« no previous file with comments | « content/browser/gamepad/gamepad_test_helpers.h ('k') | content/browser/gamepad/raw_input_data_fetcher_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698