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

Unified Diff: content/browser/gamepad/gamepad_provider_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_provider.cc ('k') | content/browser/gamepad/gamepad_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gamepad/gamepad_provider_unittest.cc
diff --git a/content/browser/gamepad/gamepad_provider_unittest.cc b/content/browser/gamepad/gamepad_provider_unittest.cc
index adfef0c5bf3d2ed749050f155b0c1655c4059661..e4f6571da27f36e8bf11722c373edf3725a83d98 100644
--- a/content/browser/gamepad/gamepad_provider_unittest.cc
+++ b/content/browser/gamepad/gamepad_provider_unittest.cc
@@ -131,26 +131,16 @@ TEST_F(GamepadProviderTest, UserGesture) {
GamepadProvider* provider = CreateProvider(no_button_data);
provider->Resume();
- // Register for a user gesture and make sure the provider reads it twice
- // see below for why).
provider->RegisterForUserGesture(listener.GetClosure());
- mock_data_fetcher_->WaitForDataRead();
- mock_data_fetcher_->WaitForDataRead();
+ mock_data_fetcher_->WaitForDataReadAndCallbacksIssued();
// It should not have issued our callback.
message_loop().RunUntilIdle();
EXPECT_FALSE(listener.has_user_gesture());
// 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.
mock_data_fetcher_->SetTestData(button_down_data);
- mock_data_fetcher_->WaitForDataRead();
- mock_data_fetcher_->WaitForDataRead();
+ mock_data_fetcher_->WaitForDataReadAndCallbacksIssued();
// It should have issued our callback.
message_loop().RunUntilIdle();
« no previous file with comments | « content/browser/gamepad/gamepad_provider.cc ('k') | content/browser/gamepad/gamepad_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698