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: content/browser/gamepad/gamepad_test_helpers.cc

Issue 1586663006: Refactoring gamepad polling to support dynamically added sources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid crash on Android content_unittests Created 4 years, 11 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
index fc79dcb5ee67ebf1648ad5620122d00d9e34bc00..365baaf9e090df80a4719ecb9b4f5233cfe2d7dc 100644
--- a/content/browser/gamepad/gamepad_test_helpers.cc
+++ b/content/browser/gamepad/gamepad_test_helpers.cc
@@ -17,11 +17,17 @@ MockGamepadDataFetcher::MockGamepadDataFetcher(
MockGamepadDataFetcher::~MockGamepadDataFetcher() {
}
-void MockGamepadDataFetcher::GetGamepadData(blink::WebGamepads* pads,
- bool devices_changed_hint) {
+void MockGamepadDataFetcher::GetGamepadData(bool devices_changed_hint) {
{
base::AutoLock lock(lock_);
- *pads = test_data_;
+
+ for (unsigned int i = 0; i < blink::WebGamepads::itemsLengthCap; ++i) {
+ if (test_data_.items[i].connected) {
+ PadState* pad = provider()->GetPadState(GAMEPAD_SOURCE_TEST, i);
+ if (pad)
+ memcpy(&pad->data, &test_data_.items[i], sizeof(blink::WebGamepad));
+ }
+ }
}
read_data_.Signal();
}
« 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