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 8837c8e59c34c20f49b0cd6486732abdd7abe2c3..fc79dcb5ee67ebf1648ad5620122d00d9e34bc00 100644 |
--- a/content/browser/gamepad/gamepad_test_helpers.cc |
+++ b/content/browser/gamepad/gamepad_test_helpers.cc |
@@ -30,6 +30,15 @@ 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; |