Bug 1531796 - Add a mochitest. r=rhunt
authorBotond Ballo <botond@mozilla.com>
Sat, 27 Apr 2019 05:06:31 +0000
changeset 530441 58093e575a85553bb3b0c2b8d181c83529d4bb33
parent 530440 8ebd99752f720b8f08529159ea1a893d71dba7f4
child 530453 7bdb46cc5ec6221c8df10f0a239dc4faf457488d
child 530454 c151677139852ef5443ec1c908f49f4cba07c7fc
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt
bugs1531796
milestone68.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 1531796 - Add a mochitest. r=rhunt Differential Revision: https://phabricator.services.mozilla.com/D29065
gfx/layers/apz/test/mochitest/helper_scrollby_bug1531796.html
gfx/layers/apz/test/mochitest/mochitest.ini
gfx/layers/apz/test/mochitest/test_group_mainthread.html
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_scrollby_bug1531796.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <meta charset="utf-8">
+  <meta name="viewport" content="width=device-width; initial-scale=1.0">
+  <title>Test that scrollBy() doesn't scroll more than it should</title>
+  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
+  <script type="application/javascript" src="apz_test_utils.js"></script>
+  <script src="/tests/SimpleTest/paint_listener.js"></script>
+  <script type="application/javascript">
+
+function* test(testDriver) {
+  if (getPlatform() == "android") {
+    ok(true, "Skipping test on Android (bug 1547435)");
+    return;
+  }
+
+  const maxSteps = 20;
+  let scrollPerStep = 40;
+  for (let step = 0; step < maxSteps; step++) {
+    window.scrollBy(0, scrollPerStep);
+    window.requestAnimationFrame(testDriver);
+    yield;
+  }
+  is(window.scrollY, maxSteps * scrollPerStep, "Scrolled by the expected amount");
+}
+
+waitUntilApzStable().then(runContinuation(test)).then(subtestDone);
+
+  </script>
+  <style>
+    body {
+      height: 5000px;
+      background: linear-gradient(red, black);
+    }
+  </style>
+</head>
+<body>
+</body>
+</html>
--- a/gfx/layers/apz/test/mochitest/mochitest.ini
+++ b/gfx/layers/apz/test/mochitest/mochitest.ini
@@ -13,16 +13,17 @@
 [test_bug1277814.html]
   skip-if = (os == 'android') # wheel events not supported on mobile
 [test_bug1304689.html]
 [test_bug1304689-2.html]
 [test_bug1464568.html]
 [test_frame_reconstruction.html]
 [test_group_fullscreen.html]
   run-if = (os == 'android')
+[test_group_mainthread.html]
 [test_group_minimum_scale_size.html]
   run-if = (os == 'android')
 [test_group_mouseevents.html]
   skip-if = (toolkit == 'android') # mouse events not supported on mobile
 [test_group_pointerevents.html]
   skip-if = (os == 'win' && os_version == '10.0') || (toolkit == 'android' && !is_fennec) # Bug 1404836, 1525959
 [test_group_touchevents.html]
   skip-if = (verify && debug && (os == 'win'))
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/test_group_mainthread.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <meta charset="utf-8">
+  <title>Tests that perform main-thread scrolling</title>
+  <script src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="apz_test_utils.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <script type="application/javascript">
+
+var subtests = [
+  {"file": "helper_scrollby_bug1531796.html"},
+];
+
+if (isApzEnabled()) {
+  SimpleTest.waitForExplicitFinish();
+  window.onload = function() {
+    runSubtestsSeriallyInFreshWindows(subtests)
+    .then(SimpleTest.finish, SimpleTest.finish);
+  };
+}
+
+  </script>
+</head>
+<body>
+</body>
+</html>