Bug 1501382 - Add a mochitest. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 12 Dec 2018 22:58:40 +0000
changeset 450364 8c491aa06a8e3943f5a946fcf9080adcdc399e0e
parent 450363 bde7618ae76524b36cfa8ede3e3819cf99d9d968
child 450365 606d75702c5cc63ea9f2cefcdac7d49aa53dabe6
push id110479
push usercsabou@mozilla.com
push dateThu, 13 Dec 2018 04:02:11 +0000
treeherdermozilla-inbound@3ecc407c0cc8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1501382
milestone66.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 1501382 - Add a mochitest. r=botond Differential Revision: https://phabricator.services.mozilla.com/D14285
gfx/layers/apz/test/mochitest/helper_touch_action_zero_opacity_bug1500864.html
gfx/layers/apz/test/mochitest/test_group_touchevents-3.html
gfx/layers/apz/test/mochitest/test_group_touchevents-4.html
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_touch_action_zero_opacity_bug1500864.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>Touch-action on a zero-opacity element</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>
+  <script type="application/javascript">
+function* test(testDriver) {
+  var target = document.getElementById('target');
+
+  document.body.addEventListener('touchend', testDriver, { passive: true });
+
+  // drag the page up to scroll down by 50px
+  yield ok(synthesizeNativeTouchDrag(target, 10, 100, 0, -50),
+      "Synthesized native vertical drag, waiting for touch-end event...");
+
+  yield flushApzRepaints(testDriver);
+
+  is(window.scrollX, 0, "X scroll offset didn't change");
+  is(window.scrollY, 0, "Y scroll offset didn't change");
+}
+
+waitUntilApzStable()
+.then(runContinuation(test))
+.then(subtestDone);
+
+  </script>
+</head>
+<body style="border: solid 1px green">
+  <div id="spacer" style="height: 2000px">
+    Inside the black border is a zero-opacity touch-action none.
+    <div id="border" style="border: solid 1px black">
+        <div id="target" style="opacity: 0; height: 300px; touch-action: none">this text shouldn't be visible</div>
+    </div>
+  </div>
+</body>
+</html>
--- a/gfx/layers/apz/test/mochitest/test_group_touchevents-3.html
+++ b/gfx/layers/apz/test/mochitest/test_group_touchevents-3.html
@@ -18,18 +18,21 @@ var touch_action_prefs = [
 var subtests = [
   // Simple test to exercise touch-action CSS property
   {'file': 'helper_touch_action.html', 'prefs': touch_action_prefs},
   // More complex touch-action tests, with overlapping regions and such
   {'file': 'helper_touch_action_complex.html', 'prefs': touch_action_prefs},
   // Tests that touch-action CSS properties are handled in APZ without waiting
   // on the main-thread, when possible
   {'file': 'helper_touch_action_regions.html', 'prefs': touch_action_prefs},
+  // Tests that touch-action inside zero-opacity items are respected
+  {'file': 'helper_touch_action_zero_opacity_bug1500864.html', 'prefs': touch_action_prefs},
 
-  // Add new subtests to test_group_touch_events-4.html, not this file.
+  // Add new subtests to test_group_touchevents-4.html, not this file (exceptions
+  // may be made for quick-running tests that need the touch-action prefs)
 ];
 
 if (isApzEnabled()) {
   ok(window.TouchEvent, "Check if TouchEvent is supported (it should be, the test harness forces it on everywhere)");
   if (getPlatform() == "android") {
     // This has a lot of subtests, and Android emulators are slow.
     SimpleTest.requestLongerTimeout(2);
   }
--- a/gfx/layers/apz/test/mochitest/test_group_touchevents-4.html
+++ b/gfx/layers/apz/test/mochitest/test_group_touchevents-4.html
@@ -5,17 +5,17 @@
   <title>Various touch tests that spawn in new windows (4)</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="application/javascript" src="apz_test_native_event_utils.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 = [
-  // touch-action tests with :active::after CSS property
+  // clicking on element with :active::after CSS property
   {'file': 'helper_bug1473108.html'},
   // Add new subtests here. If this starts timing out because it's taking too
   // long, create a test_group_touchevents-5.html file. Refer to 1423011#c57
   // for more details.
 ];
 
 if (isApzEnabled()) {
   ok(window.TouchEvent, "Check if TouchEvent is supported (it should be, the test harness forces it on everywhere)");