Title: [260971] trunk/Tools
Revision
260971
Author
[email protected]
Date
2020-04-30 15:37:27 -0700 (Thu, 30 Apr 2020)

Log Message

TestWebKitAPI.WebKit.DefaultDisplayName and TestWebKitAPI.WebKit.CustomDisplayName are flaky failures
https://bugs.webkit.org/show_bug.cgi?id=209993
<rdar://problem/61282602>

Patch by Alex Christensen <[email protected]> on 2020-04-30
Reviewed by Chris Dumez.

The display name for the web process is set on a low-priority background queue in WebProcess::updateProcessName()
so sometimes in our test it hasn't executed yet.  If it hasn't executed yet, it will soon, so try until it succeeds.

* TestWebKitAPI/Tests/WebKitCocoa/DisplayName.mm:
(TestWebKitAPI::checkUntilDisplayNameIs):
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (260970 => 260971)


--- trunk/Tools/ChangeLog	2020-04-30 22:27:02 UTC (rev 260970)
+++ trunk/Tools/ChangeLog	2020-04-30 22:37:27 UTC (rev 260971)
@@ -1,3 +1,18 @@
+2020-04-30  Alex Christensen  <[email protected]>
+
+        TestWebKitAPI.WebKit.DefaultDisplayName and TestWebKitAPI.WebKit.CustomDisplayName are flaky failures
+        https://bugs.webkit.org/show_bug.cgi?id=209993
+        <rdar://problem/61282602>
+
+        Reviewed by Chris Dumez.
+
+        The display name for the web process is set on a low-priority background queue in WebProcess::updateProcessName()
+        so sometimes in our test it hasn't executed yet.  If it hasn't executed yet, it will soon, so try until it succeeds.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/DisplayName.mm:
+        (TestWebKitAPI::checkUntilDisplayNameIs):
+        (TestWebKitAPI::TEST):
+
 2020-04-30  Jiewen Tan  <[email protected]>
 
         [WebAuthn] Optimize LocalAuthenticator

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DisplayName.mm (260970 => 260971)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DisplayName.mm	2020-04-30 22:27:02 UTC (rev 260970)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DisplayName.mm	2020-04-30 22:37:27 UTC (rev 260971)
@@ -41,6 +41,16 @@
 namespace TestWebKitAPI {
 
 #if PLATFORM(MAC)
+static void checkUntilDisplayNameIs(WKWebView *webView, NSString *expectedName, bool* done)
+{
+    [webView _getProcessDisplayNameWithCompletionHandler:^(NSString *name) {
+        if ([name isEqualToString:expectedName])
+            *done = true;
+        else
+            checkUntilDisplayNameIs(webView, expectedName, done);
+    }];
+}
+
 TEST(WebKit, CustomDisplayName)
 {
     WKWebViewConfiguration *configuration = [[WKWebViewConfiguration new] autorelease];
@@ -49,13 +59,8 @@
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500) configuration:configuration]);
     [webView synchronouslyLoadHTMLString:@"start web process"];
 
-    __block bool done = false;
-
-    [webView _getProcessDisplayNameWithCompletionHandler:^(NSString *name) {
-        EXPECT_WK_STREQ(name, displayNameToSet);
-        done = true;
-    }];
-
+    bool done = false;
+    checkUntilDisplayNameIs(webView.get(), displayNameToSet, &done);
     Util::run(&done);
 }
 
@@ -65,11 +70,7 @@
     [webView synchronouslyLoadHTMLString:@"start web process"];
 
     __block bool done = false;
-    [webView _getProcessDisplayNameWithCompletionHandler:^(NSString *name) {
-        EXPECT_WK_STREQ(name, @"TestWebKitAPI Web Content");
-        done = true;
-    }];
-
+    checkUntilDisplayNameIs(webView.get(), @"TestWebKitAPI Web Content", &done);
     Util::run(&done);
 }
 #endif // PLATFORM(MAC)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to