REGRESSION: ProcessSwap.DoSameSiteNavigationAfterCrossSiteProvisionalLoadStarted...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2019 01:16:04 +0000 (01:16 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2019 01:16:04 +0000 (01:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193977
<rdar://problem/47643716>

Reviewed by Geoff Garen.

Update API test to address flakiness on iOS. Instead of doing the last navigation after receiving the
didStartProvisionalLoad, do we right after we answer the navigation policy request. Flakiness was due
to the previous provisional committing *before* we make the last load.

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:

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

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

index 88f1c2a..e5776ef 100644 (file)
@@ -1,3 +1,17 @@
+2019-01-29  Chris Dumez  <cdumez@apple.com>
+
+        REGRESSION: ProcessSwap.DoSameSiteNavigationAfterCrossSiteProvisionalLoadStarted Failing on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=193977
+        <rdar://problem/47643716>
+
+        Reviewed by Geoff Garen.
+
+        Update API test to address flakiness on iOS. Instead of doing the last navigation after receiving the
+        didStartProvisionalLoad, do we right after we answer the navigation policy request. Flakiness was due
+        to the previous provisional committing *before* we make the last load. 
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+
 2019-01-29  Youenn Fablet  <youenn@apple.com>
 
         Adopt new SPI to evaluate server certificate trust
index db7c056..a632011 100644 (file)
@@ -2448,6 +2448,8 @@ TEST(ProcessSwap, DoSameSiteNavigationAfterCrossSiteProvisionalLoadStarted)
     auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]);
     [webView setNavigationDelegate:delegate.get()];
 
+    [webView configuration].preferences.safeBrowsingEnabled = NO;
+
     NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main1.html"]];
     [webView loadRequest:request];
 
@@ -2456,14 +2458,14 @@ TEST(ProcessSwap, DoSameSiteNavigationAfterCrossSiteProvisionalLoadStarted)
 
     auto webkitPID = [webView _webProcessIdentifier];
 
-    didStartProvisionalLoad = false;
-    request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/main.html"]];
-    [webView loadRequest:request];
+    delegate->decidePolicyForNavigationAction = ^(WKNavigationAction *, void (^decisionHandler)(WKNavigationActionPolicy)) {
+        decisionHandler(WKNavigationActionPolicyAllow);
 
-    TestWebKitAPI::Util::run(&didStartProvisionalLoad);
-    didStartProvisionalLoad = false;
+        delegate->decidePolicyForNavigationAction = nil;
+        [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main2.html"]]];
+    };
 
-    request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main2.html"]];
+    request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/main.html"]];
     [webView loadRequest:request];
 
     TestWebKitAPI::Util::run(&done);