Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Window/window-scaled-viewport-properties.html

Issue 1415513002: Remove plumbing for inert-visual-viewport flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/dom/Window/window-scaled-viewport-properties.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/window-scaled-viewport-properties.html b/third_party/WebKit/LayoutTests/fast/dom/Window/window-scaled-viewport-properties.html
index 790c0bfbb22286ea447e149c71c4098e7f569773..e25407e29e99b0575272594a576696d743214168 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Window/window-scaled-viewport-properties.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/Window/window-scaled-viewport-properties.html
@@ -4,6 +4,9 @@
body {
padding: 0px;
margin: 0px;
+ /* Overflow hidden so that the size of the scrollbar is not added to
+ the innerHeight/Width properties. */
+ overflow: hidden;
}
.spacer {
@@ -27,18 +30,21 @@
description("This test makes sure the window properties related to the\
viewport remain correct under pinch-to-zoom.");
- debug('===Unscaled===');
- debug('');
- shouldBe('window.innerWidth', '800');
- shouldBe('window.innerHeight', '600');
+
+ function testUnscaled () {
+ debug('===Unscaled===');
+ debug('');
+ shouldBe('window.innerWidth', '1600');
bokan 2015/10/19 15:01:14 Can you add a comment here (or above at the setPag
ymalik 2015/10/20 21:27:14 Done.
+ shouldBe('window.innerHeight', '1200');
+ }
function testPinchedIn() {
debug('');
debug('===Pinch Zoom in to 2X===');
debug('');
window.internals.setPageScaleFactor(2.0);
- shouldBe('window.innerWidth', '400');
- shouldBe('window.innerHeight', '300');
+ shouldBe('window.innerWidth', '1600');
+ shouldBe('window.innerHeight', '1200');
shouldBe('window.scrollX', '0');
shouldBe('window.scrollY', '0');
@@ -46,14 +52,14 @@
shouldBe('window.scrollX', '10');
shouldBe('window.scrollY', '20');
window.scrollBy(1590, 1180);
- shouldBe('window.scrollX', '1600');
- shouldBe('window.scrollY', '1200');
+ shouldBe('window.scrollX', '400');
+ shouldBe('window.scrollY', '300');
window.scrollBy(-1600, -1200);
shouldBe('window.scrollX', '0');
shouldBe('window.scrollY', '0');
window.scrollTo(1600, 1200);
- shouldBe('window.scrollX', '1600');
- shouldBe('window.scrollY', '1200');
+ shouldBe('window.scrollX', '400');
+ shouldBe('window.scrollY', '300');
bokan 2015/10/19 15:01:14 You can get rid of most of these scrollBy calls si
ymalik 2015/10/20 21:27:13 Done.
ymalik 2015/10/20 23:36:00 To be more clear about the change. I refactored th
window.scrollTo(0, 0);
shouldBe('window.scrollX', '0');
shouldBe('window.scrollY', '0');
@@ -91,14 +97,17 @@
debug('===Test OnScroll===');
debug('');
window.internals.setPageScaleFactor(1.0);
- shouldBe('window.innerWidth', '800');
- shouldBe('window.innerHeight', '600');
+ shouldBe('window.innerWidth', '1600');
+ shouldBe('window.innerHeight', '1200');
shouldBe('window.scrollX', '0');
shouldBe('window.scrollY', '0');
- // First scroll scrolls only the outer viewport.
+ // First scroll should only scroll the visual viewport because the
bokan 2015/10/19 15:01:14 None of the scrolls should be going to the visual
ymalik 2015/10/20 23:36:00 Yes, fixed the comment.
+ // layout and visual viewport are of different sizes (because of the
+ // call to setPageScaleFactorLimits above).
// Second scrolls the outer and the inner.
- // Third scrolls only the inner.
+ // Third scroll should have no affect because the layout viewport is
+ // fully scrolled.
var scrolls = [100, 400, 100];
var numScrollsReceived = 0;
var numRAFCalls = 0;
@@ -113,9 +122,8 @@
var scrollAmount = scrolls[numScrollsReceived];
window.scrollBy(scrollAmount, 0);
bokan 2015/10/19 15:01:14 scrollBy won't ever scroll the inner viewport. Thi
ymalik 2015/10/20 23:36:00 Yes, this test doesn't cover the case when we actu
} else if (numScrollsReceived == scrolls.length) {
- // Make sure scrollTo that moves only the inner viewport also
- // triggers a scroll event.
- window.scrollTo(1200, 0);
+ testFailed("Received visual viewport scroll event");
+ finishJSTest();
} else {
debug('');
finishJSTest();
@@ -127,8 +135,12 @@
var failureSentinel = function() {
if (numRAFCalls == 0) {
window.scrollBy(scrolls[0], 0);
- }else if (numRAFCalls > numScrollsReceived) {
- testFailed("Failed to receive scroll event #" + (numScrollsReceived+1));
+ } else if (numRAFCalls == scrolls.length) {
+ testPassed("Did not receive visual viewport scroll event");
+ debug('');
+ finishJSTest();
+ } else if (numRAFCalls > numScrollsReceived) {
+ testFailed("Did not receive scroll event #" + (numScrollsReceived+1));
finishJSTest();
}
++numRAFCalls;
@@ -139,12 +151,15 @@
}
function forceLayout() {
- window.scrollTo(0, 0);
+ window.scrollX;
}
function runTests() {
if (window.testRunner && window.internals) {
+ // TODO(ymalik): The call to setPageScaleFactorLimits should force
+ // layout. Fix that instead of forcing layout here.
forceLayout();
+ testUnscaled();
testPinchedIn();
testMaximallyPinchedOut();
testOnScroll();

Powered by Google App Engine
This is Rietveld 408576698