+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
@end
-static RetainPtr<WKWebView> animatedResizeWebView()
+static RetainPtr<WKWebView> createAnimatedResizeWebView()
{
RetainPtr<_WKProcessPoolConfiguration> processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]);
[processPoolConfiguration setIgnoreSynchronousMessagingTimeoutsForTesting:YES];
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];
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];