Title: [270963] trunk/Tools
Revision
270963
Author
jer.no...@apple.com
Date
2020-12-17 20:45:21 -0800 (Thu, 17 Dec 2020)

Log Message

REGRESSION: [ BigSur ] 3 PictureInPicture related API tests timing out
https://bugs.webkit.org/show_bug.cgi?id=219999

Reviewed by Eric Carlson.

Not a fix for the timeout itself, but a change which will allow us to see the Util::run() statement which
is timing out. Rather than just get a generic TIMEOUT result with no clue to the cause, a Util::run() statement
which takes longer than the specified amount of time will generate an ASSERT() error with the line number
which caused the timeout.

* TestWebKitAPI/Tests/WebKitCocoa/ExitFullscreenOnEnterPiP.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/ExitPiPOnSuspendVideoElement.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm:
(TEST):
* TestWebKitAPI/Utilities.h:
* TestWebKitAPI/cocoa/UtilitiesCocoa.mm:
(TestWebKitAPI::Util::runFor):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (270962 => 270963)


--- trunk/Tools/ChangeLog	2020-12-18 03:24:38 UTC (rev 270962)
+++ trunk/Tools/ChangeLog	2020-12-18 04:45:21 UTC (rev 270963)
@@ -1,3 +1,25 @@
+2020-12-17  Jer Noble  <jer.no...@apple.com>
+
+        REGRESSION: [ BigSur ] 3 PictureInPicture related API tests timing out
+        https://bugs.webkit.org/show_bug.cgi?id=219999
+
+        Reviewed by Eric Carlson.
+
+        Not a fix for the timeout itself, but a change which will allow us to see the Util::run() statement which
+        is timing out. Rather than just get a generic TIMEOUT result with no clue to the cause, a Util::run() statement
+        which takes longer than the specified amount of time will generate an ASSERT() error with the line number
+        which caused the timeout.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ExitFullscreenOnEnterPiP.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKitCocoa/ExitPiPOnSuspendVideoElement.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm:
+        (TEST):
+        * TestWebKitAPI/Utilities.h:
+        * TestWebKitAPI/cocoa/UtilitiesCocoa.mm:
+        (TestWebKitAPI::Util::runFor):
+
 2020-12-17  Alex Christensen  <achristen...@webkit.org>
 
         REGRESSION(r270638) decidePolicyForNewWindowAction should have non-null request

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ExitFullscreenOnEnterPiP.mm (270962 => 270963)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ExitFullscreenOnEnterPiP.mm	2020-12-18 03:24:38 UTC (rev 270962)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ExitFullscreenOnEnterPiP.mm	2020-12-18 04:45:21 UTC (rev 270963)
@@ -111,7 +111,7 @@
 
     didEnterFullscreen = false;
     [webView evaluateJavaScript:@"document.getElementById('enter-element-fullscreen').click()" completionHandler: nil];
-    TestWebKitAPI::Util::run(&didEnterFullscreen);
+    ASSERT_TRUE(TestWebKitAPI::Util::runFor(&didEnterFullscreen, 10));
     ASSERT_TRUE(didEnterFullscreen);
 
     // Make the video the "main content" by playing with a user gesture.
@@ -118,18 +118,18 @@
     __block bool didBeginPlaying = false;
     [webView performAfterReceivingMessage:@"playing" action:^{ didBeginPlaying = true; }];
     [webView evaluateJavaScript:@"document.getElementById('play').click()" completionHandler:nil];
-    TestWebKitAPI::Util::run(&didBeginPlaying);
+    ASSERT_TRUE(TestWebKitAPI::Util::runFor(&didBeginPlaying, 10));
 
     didEnterPiP = false;
     didExitFullscreen = false;
     [webView evaluateJavaScript:@"document.getElementById('enter-pip').click()" completionHandler: nil];
-    TestWebKitAPI::Util::run(&didEnterPiP);
-    TestWebKitAPI::Util::run(&didExitFullscreen);
+    ASSERT_TRUE(TestWebKitAPI::Util::runFor(&didEnterPiP, 10));
+    ASSERT_TRUE(TestWebKitAPI::Util::runFor(&didExitFullscreen, 10));
 
     sleep(1_s); // Wait for PIPAgent to launch, or it won't call -pipDidClose: callback.
 
     [webView evaluateJavaScript:@"document.getElementById('exit-pip').click()" completionHandler: nil];
-    TestWebKitAPI::Util::run(&didExitPiP);
+    ASSERT_TRUE(TestWebKitAPI::Util::runFor(&didExitPiP, 10));
 }
 
 } // namespace TestWebKitAPI

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ExitPiPOnSuspendVideoElement.mm (270962 => 270963)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ExitPiPOnSuspendVideoElement.mm	2020-12-18 03:24:38 UTC (rev 270962)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ExitPiPOnSuspendVideoElement.mm	2020-12-18 04:45:21 UTC (rev 270963)
@@ -73,13 +73,13 @@
 
     didEnterPiP = false;
     [webView evaluateJavaScript:@"document.getElementById('enter-pip').click()" completionHandler: nil];
-    TestWebKitAPI::Util::run(&didEnterPiP);
+    ASSERT_TRUE(TestWebKitAPI::Util::runFor(&didEnterPiP, 10));
 
     sleep(1_s);
 
     didExitPiP = false;
     [webView synchronouslyLoadHTMLString:@"<body>Hello world</body>"];
-    TestWebKitAPI::Util::run(&didExitPiP);
+    ASSERT_TRUE(TestWebKitAPI::Util::runFor(&didExitPiP, 10));
 }
 
 } // namespace TestWebKitAPI

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm (270962 => 270963)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm	2020-12-18 03:24:38 UTC (rev 270962)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewCloseAllMediaPresentations.mm	2020-12-18 04:45:21 UTC (rev 270963)
@@ -52,7 +52,7 @@
     [webView performAfterReceivingMessage:@"presentationmodechanged" action:^{ presentationModeChanged = true; }];
 
     [webView objectByEvaluatingJavaScriptWithUserGesture:@"document.querySelector('video').webkitSetPresentationMode('picture-in-picture')"];
-    TestWebKitAPI::Util::run(&presentationModeChanged);
+    ASSERT(TestWebKitAPI::Util::runFor(&presentationModeChanged, 10));
     do {
         if (![webView stringByEvaluatingJavaScript:@"window.internals.isChangingPresentationMode(document.querySelector('video'))"].boolValue)
             break;
@@ -65,7 +65,7 @@
 
     [webView _closeAllMediaPresentations];
 
-    TestWebKitAPI::Util::run(&presentationModeChanged);
+    ASSERT(TestWebKitAPI::Util::runFor(&presentationModeChanged, 10));
 
     EXPECT_STREQ([webView stringByEvaluatingJavaScript:@"document.querySelector('video').webkitPresentationMode"].UTF8String, "inline");
 }

Modified: trunk/Tools/TestWebKitAPI/Utilities.h (270962 => 270963)


--- trunk/Tools/TestWebKitAPI/Utilities.h	2020-12-18 03:24:38 UTC (rev 270962)
+++ trunk/Tools/TestWebKitAPI/Utilities.h	2020-12-18 04:45:21 UTC (rev 270963)
@@ -31,6 +31,10 @@
 // Runs a platform runloop until the 'done' flag is true.
 void run(bool* done);
 
+// Runs a platform runloop until the 'done' flag is true, or until the amount of seconds has passed.
+// Returns true if exiting due to the 'done' flag becoming true, or false if exiting due to a timeout.
+bool runFor(bool* done, double seconds);
+
 // Runs a platform runloop `count` number of spins.
 void spinRunLoop(uint64_t count = 1);
 

Modified: trunk/Tools/TestWebKitAPI/cocoa/UtilitiesCocoa.mm (270962 => 270963)


--- trunk/Tools/TestWebKitAPI/cocoa/UtilitiesCocoa.mm	2020-12-18 03:24:38 UTC (rev 270962)
+++ trunk/Tools/TestWebKitAPI/cocoa/UtilitiesCocoa.mm	2020-12-18 04:45:21 UTC (rev 270963)
@@ -35,6 +35,17 @@
         [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]];
 }
 
+bool runFor(bool* done, double seconds)
+{
+    auto timeoutDate = [NSDate dateWithTimeIntervalSinceNow:seconds];
+    while (!*done) {
+        if ([timeoutDate compare:[NSDate date]] != NSOrderedDescending)
+            return false;
+        [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]];
+    }
+    return true;
+}
+
 void spinRunLoop(uint64_t count)
 {
     for (uint64_t i = 0; i < count; ++i)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to