Skip to content
Permalink
Browse files
[iOS Sim Debug] REGRESSION (r244151) TestWebKitAPI.WebKit.OverrideVie…
…wportArguments is failing (197028)

https://bugs.webkit.org/show_bug.cgi?id=197028
<rdar://problem/49985290>

Reviewed by Wenson Hsieh.

* TestWebKitAPI/Tests/WebKitCocoa/OverrideViewportArguments.mm:
(TEST):
Liberal application of waitForNextPresentationUpdate works around a race
where if the page rapidly changes its viewport arguments (or an API client
rapidly changes its viewport arguments), we'd get stuck thinking that the
user had intentionally zoomed the page, and stop resetting the initial scale.
This deserves a separate bug, but no need to keep the test failing while
we think about it.


Canonical link: https://commits.webkit.org/211301@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244415 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
hortont424 committed Apr 18, 2019
1 parent f2e1750 commit 5cc0843ef428c99a0760cd69755161378c61df1e
Showing 2 changed files with 29 additions and 9 deletions.
@@ -1,3 +1,20 @@
2019-04-17 Tim Horton <timothy_horton@apple.com>

[iOS Sim Debug] REGRESSION (r244151) TestWebKitAPI.WebKit.OverrideViewportArguments is failing (197028)
https://bugs.webkit.org/show_bug.cgi?id=197028
<rdar://problem/49985290>

Reviewed by Wenson Hsieh.

* TestWebKitAPI/Tests/WebKitCocoa/OverrideViewportArguments.mm:
(TEST):
Liberal application of waitForNextPresentationUpdate works around a race
where if the page rapidly changes its viewport arguments (or an API client
rapidly changes its viewport arguments), we'd get stuck thinking that the
user had intentionally zoomed the page, and stop resetting the initial scale.
This deserves a separate bug, but no need to keep the test failing while
we think about it.

2019-04-17 Tim Horton <timothy_horton@apple.com>

REGRESSION (r241988): Switching tabs is slow
@@ -42,35 +42,38 @@
return [webView stringByEvaluatingJavaScript:@"document.body.clientWidth"];
};

auto setViewport = ^(NSDictionary *viewport) {
[webView _overrideViewportWithArguments:viewport];
[webView waitForNextPresentationUpdate];
};

[webView synchronouslyLoadHTMLString:@"<meta name='viewport' content='initial-scale=1'><div id='divWithViewportUnits' style='width: 100vw;'></div>"];
EXPECT_WK_STREQ("20", bodyWidth());

[webView _overrideViewportWithArguments:@{ @"width" : @"1000" }];
setViewport(@{ @"width" : @"1000" });
EXPECT_WK_STREQ("1000", bodyWidth());

[webView _overrideViewportWithArguments:@{ @"width" : @"1000", @"initial-scale": @"1" }];
[webView waitForNextPresentationUpdate];
setViewport(@{ @"width" : @"1000", @"initial-scale": @"1" });
EXPECT_WK_STREQ("1000", bodyWidth());
EXPECT_EQ(1., [webView scrollView].zoomScale);

[webView _overrideViewportWithArguments:@{ @"width" : @"1000", @"initial-scale": @"5" }];
[webView waitForNextPresentationUpdate];
setViewport(@{ @"width" : @"1000", @"initial-scale": @"5" });
EXPECT_WK_STREQ("1000", bodyWidth());
EXPECT_EQ(5., [webView scrollView].zoomScale);

[webView _overrideViewportWithArguments:nil];
setViewport(nil);
EXPECT_WK_STREQ("20", bodyWidth());

[webView synchronouslyLoadHTMLString:@"<meta name='viewport' content='width=10'><div id='divWithViewportUnits' style='width: 100vw;'></div>"];
EXPECT_WK_STREQ("10", bodyWidth());

[webView _overrideViewportWithArguments:@{ @"width" : @"1000", @"initial-scale": @"1" }];
setViewport(@{ @"width" : @"1000", @"initial-scale": @"1" });
EXPECT_WK_STREQ("1000", bodyWidth());

[webView _overrideViewportWithArguments:@{ @"width" : @"device-width", @"initial-scale": @"1" }];
setViewport(@{ @"width" : @"device-width", @"initial-scale": @"1" });
EXPECT_WK_STREQ("20", bodyWidth());

[webView _overrideViewportWithArguments:@{ @"width" : @"500", @"initial-scale": @"1", @"garbage": @"nonsense" }];
setViewport(@{ @"width" : @"500", @"initial-scale": @"1", @"garbage": @"nonsense" });
EXPECT_WK_STREQ("500", bodyWidth());
}

0 comments on commit 5cc0843

Please sign in to comment.