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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/viewport/verify-viewport-dimensions.html

Issue 1814013002: Visual viewport API initial implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/viewport/verify-viewport-dimensions-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/dom/viewport/verify-viewport-dimensions.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/viewport/verify-viewport-dimensions.html b/third_party/WebKit/LayoutTests/fast/dom/viewport/verify-viewport-dimensions.html
new file mode 100644
index 0000000000000000000000000000000000000000..959ceca438e5ea45e99b9905a1fe7b66a0baa680
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/viewport/verify-viewport-dimensions.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<script src="../../../resources/js-test.js"></script>
+<style>
+ body {
+ height: 2000px;
+ width: 2000px;
+ }
+</style>
+
+<script>
+ window.jsTestIsAsync = true;
+
+ description("This test verifies the dimensions of the visual viewport \
+ returned by the JS visual viewport API.");
+
+ function runTest() {
+ if (!window.eventSender || !window.internals) {
+ finishJSTest();
+ return;
+ }
+
+ // Turn off smooth scrolling.
+ internals.settings.setScrollAnimatorEnabled(false);
+
+ // Scroll both viewports.
+ eventSender.mouseMoveTo(100, 100);
+ eventSender.continuousMouseScrollBy(100, 100);
+
+ debug(" **** Initial visual viewport dimensions *****");
+ shouldBe("document.visualViewport.scrollTop", "0");
+ shouldBe("document.visualViewport.scrollLeft", "0");
+ shouldBe("document.visualViewport.clientWidth", "800");
+ shouldBe("document.visualViewport.clientHeight", "600");
+ shouldBe("document.visualViewport.pageScale", "1");
+
+ // Scale and scroll visual viewport.
+ internals.setPageScaleFactor(2);
+ internals.setVisualViewportOffset(10, 10);
+
+ debug(" **** Viewport dimensions after scale and scroll *****");
+ shouldBe("document.visualViewport.scrollTop", "10");
+ shouldBe("document.visualViewport.scrollLeft", "10");
+ shouldBe("document.visualViewport.clientWidth", "400");
+ shouldBe("document.visualViewport.clientHeight", "300");
+ shouldBe("document.visualViewport.pageScale", "2");
+
+ document.visualViewport.scrollTop = 20;
+ document.visualViewport.scrollLeft = 0;
+ debug(" **** Writable viewport dimensions *****");
+ shouldBe("document.visualViewport.scrollTop", "20");
+ shouldBe("document.visualViewport.scrollLeft", "0");
+ document.visualViewport.scrollTop = -20;
+ shouldBe("document.visualViewport.scrollTop", "0");
+ document.visualViewport.scrollTop = 20.5;
+ shouldBe("document.visualViewport.scrollTop", "20.5");
+
+ finishJSTest();
+ }
+</script>
+
+<body onload="runTest()"></body>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/viewport/verify-viewport-dimensions-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698