Title: [248128] branches/safari-608-branch/Tools
Revision
248128
Author
ryanhad...@apple.com
Date
2019-08-01 13:23:36 -0700 (Thu, 01 Aug 2019)

Log Message

Cherry-pick r248116. rdar://problem/53829168

    Improve flakiness of SOAuthorizationRedirect tests
    https://bugs.webkit.org/show_bug.cgi?id=200320
    <rdar://problem/53767057>

    Reviewed by Alex Christensen.

    This patch replaces Util::sleep(0.5) in tests that expect a SOAuthorization session to wait when the corresponding WKWebView
    is out of the window with a more precise boolean indicator: navigationPolicyDecided. The new boolean indicator is working and
    better because the authorizationPerformed should be set in the same runloop when NavigationState::decidePolicyForNavigationAction
    is executed.

    * TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm:
    (-[TestSOAuthorizationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
    (resetState):
    (TestWebKitAPI::TEST):

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

Modified Paths

Diff

Modified: branches/safari-608-branch/Tools/ChangeLog (248127 => 248128)


--- branches/safari-608-branch/Tools/ChangeLog	2019-08-01 20:17:55 UTC (rev 248127)
+++ branches/safari-608-branch/Tools/ChangeLog	2019-08-01 20:23:36 UTC (rev 248128)
@@ -1,5 +1,46 @@
 2019-08-01  Ryan Haddad  <ryanhad...@apple.com>
 
+        Cherry-pick r248116. rdar://problem/53829168
+
+    Improve flakiness of SOAuthorizationRedirect tests
+    https://bugs.webkit.org/show_bug.cgi?id=200320
+    <rdar://problem/53767057>
+    
+    Reviewed by Alex Christensen.
+    
+    This patch replaces Util::sleep(0.5) in tests that expect a SOAuthorization session to wait when the corresponding WKWebView
+    is out of the window with a more precise boolean indicator: navigationPolicyDecided. The new boolean indicator is working and
+    better because the authorizationPerformed should be set in the same runloop when NavigationState::decidePolicyForNavigationAction
+    is executed.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm:
+    (-[TestSOAuthorizationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
+    (resetState):
+    (TestWebKitAPI::TEST):
+    
+    
+    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@248116 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-08-01  Jiewen Tan  <jiewen_...@apple.com>
+
+            Improve flakiness of SOAuthorizationRedirect tests
+            https://bugs.webkit.org/show_bug.cgi?id=200320
+            <rdar://problem/53767057>
+
+            Reviewed by Alex Christensen.
+
+            This patch replaces Util::sleep(0.5) in tests that expect a SOAuthorization session to wait when the corresponding WKWebView
+            is out of the window with a more precise boolean indicator: navigationPolicyDecided. The new boolean indicator is working and
+            better because the authorizationPerformed should be set in the same runloop when NavigationState::decidePolicyForNavigationAction
+            is executed.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm:
+            (-[TestSOAuthorizationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
+            (resetState):
+            (TestWebKitAPI::TEST):
+
+2019-08-01  Ryan Haddad  <ryanhad...@apple.com>
+
         Cherry-pick r248072. rdar://problem/52355829
 
     Unreviewed test gardening, disable failing test for rdar://52355829.

Modified: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm (248127 => 248128)


--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm	2019-08-01 20:17:55 UTC (rev 248127)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm	2019-08-01 20:23:36 UTC (rev 248128)
@@ -52,6 +52,7 @@
 static bool uiShowed = false;
 static bool newWindowCreated = false;
 static bool haveHttpBody = false;
+static bool navigationPolicyDecided = false;
 static String finalURL;
 static SOAuthorization* gAuthorization;
 static id<SOAuthorizationDelegate> gDelegate;
@@ -169,6 +170,7 @@
 
 - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
 {
+    navigationPolicyDecided = true;
     EXPECT_EQ(navigationAction._shouldOpenExternalSchemes, self.shouldOpenExternalSchemes);
     if (self.isDefaultPolicy) {
         decisionHandler(WKNavigationActionPolicyAllow);
@@ -289,6 +291,7 @@
     uiShowed = false;
     newWindowCreated = false;
     haveHttpBody = false;
+    navigationPolicyDecided = false;
     finalURL = emptyString();
     gAuthorization = nullptr;
     gDelegate = nullptr;
@@ -764,7 +767,7 @@
     // The session will be waiting since the web view is is not in the window.
     [webView removeFromSuperview];
     [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]];
-    Util::sleep(0.5);
+    Util::run(&navigationPolicyDecided);
     EXPECT_FALSE(authorizationPerformed);
 
     // Should activate the session.
@@ -800,7 +803,7 @@
     // The session will be waiting since the web view is is not in the window.
     [webView removeFromSuperview];
     [webView loadRequest:[NSURLRequest requestWithURL:testURL1.get()]];
-    Util::sleep(0.5);
+    Util::run(&navigationPolicyDecided);
     EXPECT_FALSE(authorizationPerformed);
 
     [webView loadRequest:[NSURLRequest requestWithURL:testURL2.get()]];
@@ -927,12 +930,13 @@
     // The session will be waiting since the web view is is not int the window.
     [webView removeFromSuperview];
     [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]];
-    Util::sleep(0.5);
+    Util::run(&navigationPolicyDecided);
     EXPECT_FALSE(authorizationPerformed);
 
     // Suppress the last waiting session.
+    navigationPolicyDecided = false;
     [webView loadRequest:[NSURLRequest requestWithURL:testURL.get()]];
-    Util::sleep(0.5);
+    Util::run(&navigationPolicyDecided);
     EXPECT_FALSE(authorizationPerformed);
 
     // Activate the last session.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to