Title: [248116] trunk/Tools
- Revision
- 248116
- Author
- jiewen_...@apple.com
- Date
- 2019-08-01 12:32:59 -0700 (Thu, 01 Aug 2019)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (248115 => 248116)
--- trunk/Tools/ChangeLog 2019-08-01 19:12:29 UTC (rev 248115)
+++ trunk/Tools/ChangeLog 2019-08-01 19:32:59 UTC (rev 248116)
@@ -1,3 +1,21 @@
+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 Keith Rollin <krol...@apple.com>
Update TestWebKitAPI for XCBuild
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm (248115 => 248116)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm 2019-08-01 19:12:29 UTC (rev 248115)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TestSOAuthorization.mm 2019-08-01 19:32:59 UTC (rev 248116)
@@ -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