Changeset 232766 in webkit
- Timestamp:
- Jun 12, 2018 11:53:30 AM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r232756 r232766 1 2018-06-12 Tim Horton <timothy_horton@apple.com> 2 3 Add a API test for r232601 4 https://bugs.webkit.org/show_bug.cgi?id=186417 5 6 Reviewed by Wenson Hsieh. 7 8 * TestWebKitAPI/Tests/WebKitCocoa/AnimatedResize.mm: 9 (immediateSubviewOfClass): 10 (TEST): 11 Ensure that we put the view hierarchy back together (move WKContentView 12 out of the animated resize view) and unhide WKContentView after a 13 resize-with-hidden-content. 14 1 15 2018-06-12 Valerie R Young <valerie@bocoup.com> 2 16 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AnimatedResize.mm
r232593 r232766 27 27 28 28 #import "PlatformUtilities.h" 29 #import "Test.h" 29 30 #import "TestNavigationDelegate.h" 30 31 #import <WebKit/WKPreferences.h> … … 289 290 } 290 291 292 static UIView *immediateSubviewOfClass(UIView *view, Class cls) 293 { 294 UIView *foundSubview = nil; 295 296 for (UIView *subview in view.subviews) { 297 if ([subview isKindOfClass:cls]) { 298 // Make it harder to write a bad test; if there's more than one subview 299 // of the given class, fail the test! 300 ASSERT(!foundSubview); 301 302 foundSubview = subview; 303 } 304 } 305 306 return foundSubview; 307 } 308 309 TEST(WebKit, ResizeWithContentHiddenCompletes) 310 { 311 auto webView = createAnimatedResizeWebView(); 312 [webView setUIDelegate:webView.get()]; 313 314 [webView loadHTMLString:@"<head><meta name='viewport' content='initial-scale=1'></head>" baseURL:nil]; 315 auto navigationDelegate = adoptNS([[TestNavigationDelegate alloc] init]); 316 webView.get().navigationDelegate = navigationDelegate.get(); 317 [navigationDelegate waitForDidFinishNavigation]; 318 319 auto window = adoptNS([[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 800, 600)]); 320 [window addSubview:webView.get()]; 321 [window setHidden:NO]; 322 323 [webView _resizeWhileHidingContentWithUpdates:^{ 324 [webView setFrame:CGRectMake(0, 0, 100, 200)]; 325 }]; 326 327 __block bool didReadLayoutSize = false; 328 [webView _doAfterNextPresentationUpdate:^{ 329 [webView evaluateJavaScript:@"[window.innerWidth, window.innerHeight]" completionHandler:^(id value, NSError *error) { 330 CGFloat innerWidth = [[value objectAtIndex:0] floatValue]; 331 CGFloat innerHeight = [[value objectAtIndex:1] floatValue]; 332 333 EXPECT_EQ(innerWidth, 100); 334 EXPECT_EQ(innerHeight, 200); 335 336 didReadLayoutSize = true; 337 }]; 338 }]; 339 TestWebKitAPI::Util::run(&didReadLayoutSize); 340 341 UIView *scrollView = immediateSubviewOfClass(webView.get(), NSClassFromString(@"WKScrollView")); 342 UIView *contentView = immediateSubviewOfClass(scrollView, NSClassFromString(@"WKContentView")); 343 344 // Make sure that we've put the view hierarchy back together after the resize completed. 345 EXPECT_NOT_NULL(scrollView); 346 EXPECT_NOT_NULL(contentView); 347 EXPECT_FALSE(contentView.hidden); 348 } 349 291 350 #endif
Note: See TracChangeset
for help on using the changeset viewer.