Flaky API Test TestWebKitAPI.WebKitLegacy.ScrollingDoesNotPauseMedia
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2019 19:37:38 +0000 (19:37 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Mar 2019 19:37:38 +0000 (19:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195137
<rdar://problem/48810307>

Reviewed by Eric Carlson.

* TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242819 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm

index 93834aa..12c2896 100644 (file)
@@ -1,3 +1,14 @@
+2019-03-12  Jer Noble  <jer.noble@apple.com>
+
+        Flaky API Test TestWebKitAPI.WebKitLegacy.ScrollingDoesNotPauseMedia
+        https://bugs.webkit.org/show_bug.cgi?id=195137
+        <rdar://problem/48810307>
+
+        Reviewed by Eric Carlson.
+
+        * TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:
+        (TestWebKitAPI::TEST):
+
 2019-03-12  Aakash Jain  <aakash_jain@apple.com>
 
         [ews-build] Change urls from uat to production
index dc0e090..a203619 100644 (file)
@@ -30,6 +30,7 @@
 #import "PlatformUtilities.h"
 #import <WebKit/DOMHTMLMediaElement.h>
 #import <WebKit/WebFramePrivate.h>
+#import <wtf/MainThread.h>
 #import <wtf/RetainPtr.h>
 
 @interface ScrollingDoesNotPauseMediaDelegate : NSObject <UIWebViewDelegate, DOMEventListener> {
@@ -90,22 +91,30 @@ TEST(WebKitLegacy, ScrollingDoesNotPauseMedia)
     Util::run(&didFinishLoad);
     Util::run(&gotMainFrame);
 
-    DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[mainFrame.DOMDocument querySelector:@"video"];
-    ASSERT_TRUE([video isKindOfClass:[DOMHTMLMediaElement class]]);
+    callOnMainThreadAndWait([&] () mutable {
+        DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[mainFrame.DOMDocument querySelector:@"video"];
+        ASSERT_TRUE([video isKindOfClass:[DOMHTMLMediaElement class]]);
 
-    [video addEventListener:@"playing" listener:testController.get() useCapture:NO];
-    [video addEventListener:@"pause" listener:testController.get() useCapture:NO];
+        [video addEventListener:@"playing" listener:testController.get() useCapture:NO];
 
-    [mainFrame setTimeoutsPaused:YES];
+        [mainFrame setTimeoutsPaused:YES];
+        didReceivePlaying = false;
+        [video play];
+    });
 
-    didReceivePlaying = false;
-    [video play];
     Util::run(&didReceivePlaying);
 
-    [mainFrame setTimeoutsPaused:NO];
+    callOnMainThreadAndWait([&] () mutable {
+        DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[mainFrame.DOMDocument querySelector:@"video"];
+        ASSERT_TRUE([video isKindOfClass:[DOMHTMLMediaElement class]]);
+
+        [video addEventListener:@"pause" listener:testController.get() useCapture:NO];
+
+        [mainFrame setTimeoutsPaused:NO];
+        didReceivePause = false;
+        [video pause];
+    });
 
-    didReceivePause = false;
-    [video play];
     Util::run(&didReceivePause);
 }