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

Unified Diff: third_party/WebKit/LayoutTests/fast/scroll-behavior/visual-viewport-scroll-no-onscroll-event.html

Issue 1415513002: Remove plumbing for inert-visual-viewport flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Worked on review comments 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/scroll-behavior/visual-viewport-scroll-no-onscroll-event.html
diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/visual-viewport-scroll-no-onscroll-event.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/visual-viewport-scroll-no-onscroll-event.html
new file mode 100644
index 0000000000000000000000000000000000000000..3328b9a4d795b1714780b40f433ad7064fdf035c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/visual-viewport-scroll-no-onscroll-event.html
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
bokan 2015/10/21 13:32:15 Please change the doctype on any of these tests to
ymalik 2015/10/21 15:14:08 Done.
+<script src="../../resources/js-test.js"></script>
+<style>
+ #target {
+ width: 2000px;
+ height: 1500px;
+ }
+</style>
+<script language="JavaScript" type="text/javascript">
+ var shouldTrigger;
bokan 2015/10/21 13:32:15 unused.
ymalik 2015/10/21 15:14:08 Done.
+ if (window.testRunner && window.internals) {
+ window.jsTestIsAsync = true;
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ setPrintTestResultsLazily();
+ }
+
+ description("This test ensures that scrolling the visual viewport doesn't\
+ trigger an onscroll event.");
+
+ function runTest() {
+ if (!window.testRunner || !window.internals) {
+ testFailed("This test requires test runner and inernals.")
+ finishJSTest();
+ return;
+ }
+
+ window.internals.setPageScaleFactor(2.0);
+ var target = document.getElementById('target');
+
+ // The first scroll should trigger onscroll because it scrolls the
+ // layout viewport. The second scroll should not trigger onscroll
+ // because it only scrolls the visual viewport.
+ var scrolls = [-10, 1];
+ var numScrollsReceived = 0;
+ var numRAFCalls = 0;
+
+ document.onscroll = function() {
+ if (numRAFCalls == 0)
+ return;
+
+ ++numScrollsReceived;
+ debug('PASS OnScroll called for scroll #' + numScrollsReceived);
+ if (numScrollsReceived < scrolls.length) {
+ var scrollAmount = scrolls[numScrollsReceived];
+ eventSender.mouseMoveTo(target.offsetLeft + 5, target.offsetTop + 5);
+ eventSender.mouseScrollBy(0, scrollAmount);
+ } else if (numScrollsReceived == scrolls.length) {
+ testFailed("Received visual viewport scroll event");
+ finishJSTest();
+ } else {
+ debug('');
+ finishJSTest();
+ }
+ }
+
+ var failureSentinel = function() {
+ if (numRAFCalls == 0) {
+ eventSender.mouseMoveTo(target.offsetLeft + 5, target.offsetTop + 5);
+ eventSender.mouseScrollBy(0, scrolls[0]);
+ } else if (numRAFCalls == scrolls.length && numScrollsReceived < numRAFCalls) {
bokan 2015/10/21 13:32:15 I know I wrote this, but this is incredibly hard t
ymalik 2015/10/21 15:14:08 Done. Thanks for simplifying it.
+ testPassed("Did not receive visual viewport scroll event");
+ finishJSTest();
+ } else if (numRAFCalls > numScrollsReceived) {
+ testFailed("Did not receive scroll event #" + (numScrollsReceived+1));
+ finishJSTest();
+ }
+ ++numRAFCalls;
+ window.requestAnimationFrame(failureSentinel);
+ }
+
+ window.requestAnimationFrame(failureSentinel);
+ }
+
+ onload = runTest;
+</script>
+<div id="target"></div>

Powered by Google App Engine
This is Rietveld 408576698