Unreviewed, fix ProcessSwap.OpenerLinkAfterAPIControlledProcessSwappingOfOpener API...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 May 2019 02:15:21 +0000 (02:15 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 May 2019 02:15:21 +0000 (02:15 +0000)
It became flaky after r245198.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

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

Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm

index c7f70eb..aadfaca 100644 (file)
@@ -1,3 +1,11 @@
+2019-05-10  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, fix ProcessSwap.OpenerLinkAfterAPIControlledProcessSwappingOfOpener API test
+
+        It became flaky after r245198.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+
 2019-05-10  Youenn Fablet  <youenn@apple.com>
 
         A service worker instance should be terminated when its SWServer is destroyed
index 436ac52..2e8e8e2 100644 (file)
@@ -4574,14 +4574,22 @@ TEST(ProcessSwap, OpenerLinkAfterAPIControlledProcessSwappingOfOpener)
 
     auto pid2 = [webView _webProcessIdentifier];
     EXPECT_NE(pid1, pid2);
-
-    // Auxiliary window's opener should no longer have an opener.
-    [createdWebView evaluateJavaScript:@"window.opener ? 'true' : 'false'" completionHandler: [&] (id hasOpener, NSError *error) {
-        EXPECT_WK_STREQ(@"false", hasOpener);
-        done = true;
-    }];
-    TestWebKitAPI::Util::run(&done);
-    done = false;
+    
+    bool hasOpener = true;
+    int timeout = 50;
+    do {
+        if (timeout != 50)
+            TestWebKitAPI::Util::sleep(0.1);
+        
+        // Auxiliary window's opener should no longer have an opener.
+        [createdWebView evaluateJavaScript:@"window.opener ? 'true' : 'false'" completionHandler: [&] (id hasOpenerString, NSError *error) {
+            hasOpener = [hasOpenerString isEqualToString:@"true"];
+            done = true;
+        }];
+        TestWebKitAPI::Util::run(&done);
+        done = false;
+    } while (hasOpener && (--timeout));
+    EXPECT_FALSE(hasOpener);
 
     [createdWebView evaluateJavaScript:@"savedOpener.closed ? 'true' : 'false'" completionHandler: [&] (id savedOpenerIsClosed, NSError *error) {
         EXPECT_WK_STREQ(@"true", savedOpenerIsClosed);