REGRESSION (r205329): Two API tests time out on iOS Simulator
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Sep 2016 19:42:23 +0000 (19:42 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Sep 2016 19:42:23 +0000 (19:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=161542

Reviewed by Brady Eidson.

* TestWebKitAPI/Tests/WebKit2Cocoa/AnimatedResize.mm:
(createAnimatedResizeWebView):
(createFirstVisuallyNonEmptyWatchingNavigationDelegate):
(TEST):
(animatedResizeWebView): Deleted.
The navigation delegate was being stored in a local and went out of scope
before the test was over. Keep it around, instead.

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

Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AnimatedResize.mm

index 6fb5818..8add8d7 100644 (file)
@@ -1,3 +1,18 @@
+2016-09-02  Tim Horton  <timothy_horton@apple.com>
+
+        REGRESSION (r205329): Two API tests time out on iOS Simulator
+        https://bugs.webkit.org/show_bug.cgi?id=161542
+
+        Reviewed by Brady Eidson.
+
+        * TestWebKitAPI/Tests/WebKit2Cocoa/AnimatedResize.mm:
+        (createAnimatedResizeWebView):
+        (createFirstVisuallyNonEmptyWatchingNavigationDelegate):
+        (TEST):
+        (animatedResizeWebView): Deleted.
+        The navigation delegate was being stored in a local and went out of scope
+        before the test was over. Keep it around, instead.
+
 2016-08-31  Jer Noble  <jer.noble@apple.com>
 
         Refactor MobileMiniBrowser into an application framework to allow external XCTesting
index 5aa07f3..f2d309a 100644 (file)
@@ -55,7 +55,7 @@ static bool didEndAnimatedResize;
 
 @end
 
-static RetainPtr<WKWebView> animatedResizeWebView()
+static RetainPtr<WKWebView> createAnimatedResizeWebView()
 {
     RetainPtr<_WKProcessPoolConfiguration> processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
     [processPoolConfiguration setIgnoreSynchronousMessagingTimeoutsForTesting:YES];
@@ -66,22 +66,27 @@ static RetainPtr<WKWebView> animatedResizeWebView()
 
     RetainPtr<WKWebView> webView = adoptNS([[AnimatedResizeWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
 
+    NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"blinking-div" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+    [webView loadRequest:request];
+
+    return webView;
+}
+
+static RetainPtr<TestNavigationDelegate> createFirstVisuallyNonEmptyWatchingNavigationDelegate()
+{
     auto navigationDelegate = adoptNS([[TestNavigationDelegate alloc] init]);
     [navigationDelegate setRenderingProgressDidChange:^(WKWebView *, _WKRenderingProgressEvents progressEvents) {
         if (progressEvents & _WKRenderingProgressEventFirstVisuallyNonEmptyLayout)
             didLayout = true;
     }];
-    [webView setNavigationDelegate:navigationDelegate.get()];
-
-    NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"blinking-div" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
-    [webView loadRequest:request];
-
-    return webView;
+    return navigationDelegate;
 }
 
 TEST(WebKit2, ResizeWithHiddenContentDoesNotHang)
 {
-    auto webView = animatedResizeWebView();
+    auto webView = createAnimatedResizeWebView();
+    auto navigationDelegate = createFirstVisuallyNonEmptyWatchingNavigationDelegate();
+    [webView setNavigationDelegate:navigationDelegate.get()];
     RetainPtr<UIWindow> window = adoptNS([[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 800, 600)]);
     [window addSubview:webView.get()];
     [window setHidden:NO];
@@ -101,7 +106,9 @@ TEST(WebKit2, ResizeWithHiddenContentDoesNotHang)
 
 TEST(WebKit2, AnimatedResizeDoesNotHang)
 {
-    auto webView = animatedResizeWebView();
+    auto webView = createAnimatedResizeWebView();
+    auto navigationDelegate = createFirstVisuallyNonEmptyWatchingNavigationDelegate();
+    [webView setNavigationDelegate:navigationDelegate.get()];
     RetainPtr<UIWindow> window = adoptNS([[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 800, 600)]);
     [window addSubview:webView.get()];
     [window setHidden:NO];