Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / content / browser / gamepad / gamepad_test_helpers.cc
index 8837c8e..fc79dcb 100644 (file)
@@ -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;