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

Unified Diff: content/browser/renderer_host/pepper/pepper_gamepad_host_unittest.cc

Issue 362123002: Gamepad: don't notify about connected pads twice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more build fix (kNumberOfGamepads) Created 6 years, 6 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_test_helpers.cc ('k') | content/content_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/pepper/pepper_gamepad_host_unittest.cc
diff --git a/content/browser/renderer_host/pepper/pepper_gamepad_host_unittest.cc b/content/browser/renderer_host/pepper/pepper_gamepad_host_unittest.cc
index f86c944a46d6281c07d29a76016d13c044e461ad..38bc0e267e86396631a4f53a62fd81420d46a8eb 100644
--- a/content/browser/renderer_host/pepper/pepper_gamepad_host_unittest.cc
+++ b/content/browser/renderer_host/pepper/pepper_gamepad_host_unittest.cc
@@ -140,29 +140,19 @@ TEST_F(PepperGamepadHostTest, WaitForReply) {
gamepad_host.OnResourceMessageReceived(
PpapiHostMsg_Gamepad_RequestMemory(), &context));
- // Wait for the gamepad background thread to read twice to make sure we
- // don't get a message yet (see below for why).
MockGamepadDataFetcher* fetcher = service_->data_fetcher();
- fetcher->WaitForDataRead();
- fetcher->WaitForDataRead();
+ fetcher->WaitForDataReadAndCallbacksIssued();
// It should not have sent the callback message.
service_->message_loop().RunUntilIdle();
EXPECT_EQ(0u, sink().message_count());
// Set a button down and wait for it to be read twice.
- //
- // We wait for two reads before calling RunAllPending because the provider
- // will read the data on the background thread (setting the event) and *then*
- // will issue the callback on our thread. Waiting for it to read twice
- // ensures that it was able to issue callbacks for the first read (if it
- // issued one) before we try to check for it.
blink::WebGamepads button_down_data = default_data;
button_down_data.items[0].buttons[0].value = 1.f;
button_down_data.items[0].buttons[0].pressed = true;
fetcher->SetTestData(button_down_data);
- fetcher->WaitForDataRead();
- fetcher->WaitForDataRead();
+ fetcher->WaitForDataReadAndCallbacksIssued();
// It should have sent a callback.
service_->message_loop().RunUntilIdle();
« no previous file with comments | « content/browser/gamepad/gamepad_test_helpers.cc ('k') | content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698