Bug 1346632 - Add a mochitest. r=kats
authorBotond Ballo <botond@mozilla.com>
Wed, 15 Mar 2017 17:49:50 -0400
changeset 348444 d921a7db8025a3f10879bb6a3c33ac054a745ea9
parent 348443 70f18aee1eff89be3fee64945ae3896f5b2995e5
child 348445 56dcf92f974c3b05e3d188161a245ae63b68e900
push id39171
push userbballo@mozilla.com
push dateMon, 20 Mar 2017 18:12:33 +0000
treeherderautoland@d921a7db8025 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1346632
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1346632 - Add a mochitest. r=kats MozReview-Commit-ID: 2o3cpTaGG1V
gfx/layers/apz/test/mochitest/helper_bug1346632.html
gfx/layers/apz/test/mochitest/mochitest.ini
gfx/layers/apz/test/mochitest/test_group_mouseevents.html
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_bug1346632.html
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <meta charset="utf-8">
+  <meta name="viewport" content="width=device-width; initial-scale=1.0">
+  <title>Dragging the scrollbar on a page with a fixed-positioned element just past the right edge of the content</title>
+  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
+  <script type="application/javascript" src="apz_test_utils.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
+  <style>
+    body {
+      height: 2000px;
+    }
+    #fixed {
+      width: 240px;
+      height: 100%;
+      position: fixed;
+      top: 0px;
+      right: -240px;
+      z-index: 1000;
+      overflow-y: scroll;
+    }
+    #fixed-content {
+      height: 2000px;
+    }
+  </style>
+  <script type="text/javascript">
+var root;
+var scrollPos;
+var haveScrolled = false;
+var generatedAll = false;
+
+// Be careful not to call subtestDone() until we've scrolled AND generated
+// all of the events.
+function maybeDone() {
+  if (haveScrolled && generatedAll) {
+    subtestDone();
+  }
+}
+
+function scrolled(e) {
+  // Test that we have scrolled
+  ok(root.scrollTop > scrollPos, "document scrolled after dragging scrollbar");
+  haveScrolled = true;
+  maybeDone();
+}
+
+function* test(testDriver) {
+  root = document.scrollingElement;
+  scrollPos = root.scrollTop;
+  document.addEventListener('scroll', scrolled);
+
+  var scrollbarX = (window.innerWidth + root.clientWidth) / 2;
+  // Move the mouse to the scrollbar
+  yield synthesizeNativeMouseEvent(root, scrollbarX, 100, nativeMouseMoveEventMsg(), testDriver);
+  // mouse down
+  yield synthesizeNativeMouseEvent(root, scrollbarX, 100, nativeMouseDownEventMsg(), testDriver);
+  // drag vertically
+  yield synthesizeNativeMouseEvent(root, scrollbarX, 150, nativeMouseMoveEventMsg(), testDriver);
+  // and release
+  yield synthesizeNativeMouseEvent(root, scrollbarX, 150, nativeMouseUpEventMsg(), testDriver);
+
+  generatedAll = true;
+  maybeDone();
+}
+
+waitUntilApzStable()
+.then(runContinuation(test));
+
+  </script>
+</head>
+<body>
+  <div id="fixed">
+    <p id="fixed-content"></p>
+  </div>
+</body>
+</html>
--- a/gfx/layers/apz/test/mochitest/mochitest.ini
+++ b/gfx/layers/apz/test/mochitest/mochitest.ini
@@ -5,16 +5,17 @@
     helper_basic_pan.html
     helper_bug982141.html
     helper_bug1151663.html
     helper_bug1162771.html
     helper_bug1271432.html
     helper_bug1280013.html
     helper_bug1285070.html
     helper_bug1299195.html
+    helper_bug1346632.html
     helper_click.html
     helper_div_pan.html
     helper_drag_click.html
     helper_drag_scroll.html
     helper_iframe_pan.html
     helper_iframe1.html
     helper_iframe2.html
     helper_long_tap.html
--- a/gfx/layers/apz/test/mochitest/test_group_mouseevents.html
+++ b/gfx/layers/apz/test/mochitest/test_group_mouseevents.html
@@ -12,17 +12,19 @@ var subtests = [
   // Sanity test to synthesize a mouse click
   {'file': 'helper_click.html?dtc=false'},
   // Same as above, but with a dispatch-to-content region that exercises the
   // main-thread notification codepaths for mouse events
   {'file': 'helper_click.html?dtc=true'},
   // Sanity test for click but with some mouse movement between the down and up
   {'file': 'helper_drag_click.html'},
   // Test for dragging on a fake-scrollbar element that scrolls the page
-  {'file': 'helper_drag_scroll.html'}
+  {'file': 'helper_drag_scroll.html'},
+  // Test for dragging the scrollbar with a fixed-pos element overlaying it
+  {'file': 'helper_bug1346632.html'}
 ];
 
 if (isApzEnabled()) {
   SimpleTest.waitForExplicitFinish();
   window.onload = function() {
     runSubtestsSeriallyInFreshWindows(subtests)
     .then(SimpleTest.finish);
   };