Flaky API Test TestWebKitAPI.WebKit.PerformedActionForURL
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Apr 2019 21:50:06 +0000 (21:50 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Apr 2019 21:50:06 +0000 (21:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196151

Reviewed by Chris Dumez.

* TestWebKitAPI/Tests/WebKitCocoa/ContentRuleListNotification.mm:
(TEST):
We were assuming that messages were received in a certain order.
Actually wait for all messages to be received before checking results.

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

Tools/TestWebKitAPI/Tests/WebKitCocoa/ContentRuleListNotification.mm

index 6b1a0f6..42373c4 100644 (file)
@@ -168,7 +168,9 @@ TEST(WebKit, PerformedActionForURL)
     [webView setUIDelegate:delegate.get()];
     [webView loadHTMLString:@"<script>fetch('notify').then(function(){fetch('block').then().catch(function(){alert('test complete')})})</script>" baseURL:[NSURL URLWithString:@"apitest:///"]];
     TestWebKitAPI::Util::run(&receivedAlert);
-    
+    while (notificationList.size() < 2)
+        TestWebKitAPI::Util::spinRunLoop();
+
     Vector<Notification> expectedNotifications {
         { "firstList", "apitest:///notify", false, false, false, { "testnotification" } },
         { "secondList", "apitest:///block", true, false, false, { } }