Title: [231208] trunk/Tools
Revision
231208
Author
[email protected]
Date
2018-05-01 13:40:22 -0700 (Tue, 01 May 2018)

Log Message

REGRESSION (r230919): API test WebKit.AutoLayoutIntegration is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=184918
<rdar://problem/39705516>

Reviewed by Wenson Hsieh.

Make sure provisional load has started before calling beginLayoutAtMinimumWidth
on the AutoLayoutWKWebView to restore pre-r230919 behavior. The load now starts
asynchronously because we ask the client if it is OK to do the load and the policy
delegates are asynchronous nowadays.

* TestWebKitAPI/Tests/WebKitCocoa/AutoLayoutIntegration.mm:
(-[AutoLayoutWKWebView load:withWidth:expectingContentSize:resettingWidth:]):
* TestWebKitAPI/cocoa/TestNavigationDelegate.h:
* TestWebKitAPI/cocoa/TestNavigationDelegate.mm:
(-[TestNavigationDelegate webView:didStartProvisionalNavigation:]):
(-[TestNavigationDelegate waitForDidStartProvisionalNavigation]):
(-[WKWebView _test_waitForDidStartProvisionalNavigation]):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (231207 => 231208)


--- trunk/Tools/ChangeLog	2018-05-01 20:37:31 UTC (rev 231207)
+++ trunk/Tools/ChangeLog	2018-05-01 20:40:22 UTC (rev 231208)
@@ -1,3 +1,24 @@
+2018-05-01  Chris Dumez  <[email protected]>
+
+        REGRESSION (r230919): API test WebKit.AutoLayoutIntegration is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=184918
+        <rdar://problem/39705516>
+
+        Reviewed by Wenson Hsieh.
+
+        Make sure provisional load has started before calling beginLayoutAtMinimumWidth
+        on the AutoLayoutWKWebView to restore pre-r230919 behavior. The load now starts
+        asynchronously because we ask the client if it is OK to do the load and the policy
+        delegates are asynchronous nowadays.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/AutoLayoutIntegration.mm:
+        (-[AutoLayoutWKWebView load:withWidth:expectingContentSize:resettingWidth:]):
+        * TestWebKitAPI/cocoa/TestNavigationDelegate.h:
+        * TestWebKitAPI/cocoa/TestNavigationDelegate.mm:
+        (-[TestNavigationDelegate webView:didStartProvisionalNavigation:]):
+        (-[TestNavigationDelegate waitForDidStartProvisionalNavigation]):
+        (-[WKWebView _test_waitForDidStartProvisionalNavigation]):
+
 2018-05-01  Ross Kirsling  <[email protected]>
 
         [WinCairo] Align buildbot test stages with AppleWin.

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AutoLayoutIntegration.mm (231207 => 231208)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AutoLayoutIntegration.mm	2018-05-01 20:37:31 UTC (rev 231207)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AutoLayoutIntegration.mm	2018-05-01 20:40:22 UTC (rev 231208)
@@ -71,6 +71,7 @@
     "</style>";
 
     [self loadHTMLString:[baseHTML stringByAppendingString:HTMLString] baseURL:nil];
+    [self _test_waitForDidStartProvisionalNavigation];
     [self beginLayoutAtMinimumWidth:width andExpectContentSizeChange:size];
     [self _test_waitForDidFinishNavigation];
 

Modified: trunk/Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.h (231207 => 231208)


--- trunk/Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.h	2018-05-01 20:37:31 UTC (rev 231207)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.h	2018-05-01 20:40:22 UTC (rev 231208)
@@ -33,15 +33,18 @@
 @interface TestNavigationDelegate : NSObject <WKNavigationDelegate>
 
 @property (nonatomic, copy) void (^didFailProvisionalNavigation)(WKWebView *, WKNavigation *, NSError *);
+@property (nonatomic, copy) void (^didStartProvisionalNavigation)(WKWebView *, WKNavigation *);
 @property (nonatomic, copy) void (^didFinishNavigation)(WKWebView *, WKNavigation *);
 @property (nonatomic, copy) void (^renderingProgressDidChange)(WKWebView *, _WKRenderingProgressEvents);
 @property (nonatomic, copy) void (^webContentProcessDidTerminate)(WKWebView *);
 
+- (void)waitForDidStartProvisionalNavigation;
 - (void)waitForDidFinishNavigation;
 
 @end
 
 @interface WKWebView (TestWebKitAPIExtras)
+- (void)_test_waitForDidStartProvisionalNavigation;
 - (void)_test_waitForDidFinishNavigation;
 @end
 

Modified: trunk/Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.mm (231207 => 231208)


--- trunk/Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.mm	2018-05-01 20:37:31 UTC (rev 231207)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.mm	2018-05-01 20:40:22 UTC (rev 231208)
@@ -33,6 +33,12 @@
 
 @implementation TestNavigationDelegate
 
+- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation
+{
+    if (_didStartProvisionalNavigation)
+        _didStartProvisionalNavigation(webView, navigation);
+}
+
 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error
 {
     if (_didFailProvisionalNavigation)
@@ -57,6 +63,20 @@
         _renderingProgressDidChange(webView, progressEvents);
 }
 
+- (void)waitForDidStartProvisionalNavigation
+{
+    EXPECT_FALSE(self.didStartProvisionalNavigation);
+
+    __block bool finished = false;
+    self.didStartProvisionalNavigation = ^(WKWebView *, WKNavigation *) {
+        finished = true;
+    };
+
+    TestWebKitAPI::Util::run(&finished);
+
+    self.didStartProvisionalNavigation = nil;
+}
+
 - (void)waitForDidFinishNavigation
 {
     EXPECT_FALSE(self.didFinishNavigation);
@@ -75,6 +95,17 @@
 
 @implementation WKWebView (TestWebKitAPIExtras)
 
+- (void)_test_waitForDidStartProvisionalNavigation
+{
+    EXPECT_FALSE(self.navigationDelegate);
+
+    auto navigationDelegate = adoptNS([[TestNavigationDelegate alloc] init]);
+    self.navigationDelegate = navigationDelegate.get();
+    [navigationDelegate waitForDidStartProvisionalNavigation];
+
+    self.navigationDelegate = nil;
+}
+
 - (void)_test_waitForDidFinishNavigation
 {
     EXPECT_FALSE(self.navigationDelegate);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to