Bug 1470251 - Split test_group_touchevents into multiple files. r?botond
MozReview-Commit-ID: FNZvv7URTRH
--- a/gfx/layers/apz/test/mochitest/apz_test_utils.js
+++ b/gfx/layers/apz/test/mochitest/apz_test_utils.js
@@ -674,16 +674,46 @@ function hitTestScrollbar(params) {
};
checkHitResult(hitTest(horizontalScrollbarPoint),
expectedHitInfo,
params.expectedScrollId,
scrollframeMsg + " - horizontal scrollbar");
}
}
+// Return a list of prefs for the given test identifier.
+function getPrefs(ident) {
+ switch (ident) {
+ case "TOUCH_EVENTS:PAN":
+ return [
+ // Dropping the touch slop to 0 makes the tests easier to write because
+ // we can just do a one-pixel drag to get over the pan threshold rather
+ // than having to hard-code some larger value.
+ ["apz.touch_start_tolerance", "0.0"],
+ // The touchstart from the drag can turn into a long-tap if the touch-move
+ // events get held up. Try to prevent that by making long-taps require
+ // a 10 second hold. Note that we also cannot enable chaos mode on this
+ // test for this reason, since chaos mode can cause the long-press timer
+ // to fire sooner than the pref dictates.
+ ["ui.click_hold_context_menus.delay", 10000],
+ // The subtests in this test do touch-drags to pan the page, but we don't
+ // want those pans to turn into fling animations, so we increase the
+ // fling min velocity requirement absurdly high.
+ ["apz.fling_min_velocity_threshold", "10000"],
+ // The helper_div_pan's div gets a displayport on scroll, but if the
+ // test takes too long the displayport can expire before the new scroll
+ // position is synced back to the main thread. So we disable displayport
+ // expiry for these tests.
+ ["apz.displayport_expiry_ms", 0],
+ ];
+ default:
+ return [];
+ }
+}
+
var ApzCleanup = {
_cleanups: [],
register: function(func) {
if (this._cleanups.length == 0) {
if (!window.isApzSubtest) {
SimpleTest.registerCleanupFunction(this.execute.bind(this));
} // else ApzCleanup.execute is called from runSubtestsSeriallyInFreshWindows
--- a/gfx/layers/apz/test/mochitest/mochitest.ini
+++ b/gfx/layers/apz/test/mochitest/mochitest.ini
@@ -18,16 +18,20 @@
skip-if = (toolkit == 'android') # setAsyncScrollOffset doesn't work on mobile
[test_frame_reconstruction.html]
[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' # Bug 1404836
[test_group_touchevents.html]
skip-if = (verify && debug && (os == 'win'))
+[test_group_touchevents-2.html]
+ skip-if = (verify && debug && (os == 'win'))
+[test_group_touchevents-3.html]
+ skip-if = (verify && debug && (os == 'win'))
[test_group_wheelevents.html]
skip-if = (toolkit == 'android') # wheel events not supported on mobile
[test_group_zoom.html]
skip-if = (toolkit != 'android') # only android supports zoom
[test_interrupted_reflow.html]
[test_group_keyboard.html]
[test_layerization.html]
skip-if = (os == 'android') # wheel events not supported on mobile
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/test_group_touchevents-2.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Various touch tests that spawn in new windows (2)</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 isWindows = getPlatform() == "windows";
+
+var subtests = [
+ // Taps on media elements to make sure the touchend event is delivered
+ // properly. We increase the long-tap timeout to ensure it doesn't get trip
+ // during the tap.
+ // Also this test (on Windows) cannot satisfy the OS requirement of providing
+ // an injected touch event every 100ms, because it waits for a paint between
+ // the touchstart and the touchend, so we have to use the "fake injection"
+ // code instead.
+ {'file': 'helper_bug1162771.html', 'prefs': [["ui.click_hold_context_menus.delay", 10000],
+ ["apz.test.fails_with_native_injection", isWindows]]},
+
+ // As with the previous test, this test cannot inject touch events every 100ms
+ // because it waits for a long-tap, so we have to use the "fake injection" code
+ // instead.
+ {'file': 'helper_long_tap.html', 'prefs': [["apz.test.fails_with_native_injection", isWindows]]},
+
+ // For the following tests, we want to make sure APZ doesn't wait for a content
+ // response that is never going to arrive. To detect this we set the content response
+ // timeout to a day, so that the entire test times out and fails if APZ does
+ // end up waiting.
+ {'file': 'helper_tap_passive.html', 'prefs': [["apz.content_response_timeout", 24 * 60 * 60 * 1000],
+ ["apz.test.fails_with_native_injection", isWindows]]},
+
+ {'file': 'helper_tap_default_passive.html', 'prefs': [["apz.content_response_timeout", 24 * 60 * 60 * 1000],
+ ["apz.test.fails_with_native_injection", isWindows],
+ ["dom.event.default_to_passive_touch_listeners", true]]},
+
+ // Add new subtests to test_group_touch_events-3.html, not this file.
+];
+
+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);
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ window.onload = function() {
+ runSubtestsSeriallyInFreshWindows(subtests)
+ .then(SimpleTest.finish, SimpleTest.finish);
+ };
+}
+
+ </script>
+</head>
+<body>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/test_group_touchevents-3.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Various touch tests that spawn in new windows (3)</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 touch_action_prefs = [
+ ...getPrefs("TOUCH_EVENTS:PAN"),
+ ["layout.css.touch_action.enabled", true],
+ ["apz.test.fails_with_native_injection", getPlatform() == "windows"],
+];
+
+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},
+ // Add new subtests here. If this starts timing out because it's taking too
+ // long, create a test_group_touchevents-4.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)");
+ if (getPlatform() == "android") {
+ // This has a lot of subtests, and Android emulators are slow.
+ SimpleTest.requestLongerTimeout(2);
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ window.onload = function() {
+ runSubtestsSeriallyInFreshWindows(subtests)
+ .then(SimpleTest.finish, SimpleTest.finish);
+ };
+}
+
+ </script>
+</head>
+<body>
+</body>
+</html>
--- a/gfx/layers/apz/test/mochitest/test_group_touchevents.html
+++ b/gfx/layers/apz/test/mochitest/test_group_touchevents.html
@@ -4,43 +4,17 @@
<meta charset="utf-8">
<title>Various touch tests that spawn in new windows</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 basic_pan_prefs = [
- // Dropping the touch slop to 0 makes the tests easier to write because
- // we can just do a one-pixel drag to get over the pan threshold rather
- // than having to hard-code some larger value.
- ["apz.touch_start_tolerance", "0.0"],
- // The touchstart from the drag can turn into a long-tap if the touch-move
- // events get held up. Try to prevent that by making long-taps require
- // a 10 second hold. Note that we also cannot enable chaos mode on this
- // test for this reason, since chaos mode can cause the long-press timer
- // to fire sooner than the pref dictates.
- ["ui.click_hold_context_menus.delay", 10000],
- // The subtests in this test do touch-drags to pan the page, but we don't
- // want those pans to turn into fling animations, so we increase the
- // fling min velocity requirement absurdly high.
- ["apz.fling_min_velocity_threshold", "10000"],
- // The helper_div_pan's div gets a displayport on scroll, but if the
- // test takes too long the displayport can expire before the new scroll
- // position is synced back to the main thread. So we disable displayport
- // expiry for these tests.
- ["apz.displayport_expiry_ms", 0],
-];
-
-var touch_action_prefs = basic_pan_prefs.slice(); // make a copy
-touch_action_prefs.push(["layout.css.touch_action.enabled", true]);
-
-var isWindows = (getPlatform() == "windows");
-touch_action_prefs.push(["apz.test.fails_with_native_injection", isWindows]);
+var basic_pan_prefs = getPrefs("TOUCH_EVENTS:PAN");
var subtests = [
// Simple tests to exercise basic panning behaviour
{'file': 'helper_basic_pan.html', 'prefs': basic_pan_prefs},
{'file': 'helper_div_pan.html', 'prefs': basic_pan_prefs},
{'file': 'helper_iframe_pan.html', 'prefs': basic_pan_prefs},
// Simple test to exercise touch-tapping behaviour
@@ -48,49 +22,17 @@ var subtests = [
// Tapping, but with a full-zoom applied
{'file': 'helper_tap_fullzoom.html'},
// For the following two tests, disable displayport suppression to make sure it
// doesn't interfere with the test by scheduling paints non-deterministically.
{'file': 'helper_scrollto_tap.html?true', 'prefs': [["apz.paint_skipping.enabled", true]], 'dp_suppression': false},
{'file': 'helper_scrollto_tap.html?false', 'prefs': [["apz.paint_skipping.enabled", false]], 'dp_suppression': false},
- // Taps on media elements to make sure the touchend event is delivered
- // properly. We increase the long-tap timeout to ensure it doesn't get trip
- // during the tap.
- // Also this test (on Windows) cannot satisfy the OS requirement of providing
- // an injected touch event every 100ms, because it waits for a paint between
- // the touchstart and the touchend, so we have to use the "fake injection"
- // code instead.
- {'file': 'helper_bug1162771.html', 'prefs': [["ui.click_hold_context_menus.delay", 10000],
- ["apz.test.fails_with_native_injection", isWindows]]},
-
- // As with the previous test, this test cannot inject touch events every 100ms
- // because it waits for a long-tap, so we have to use the "fake injection" code
- // instead.
- {'file': 'helper_long_tap.html', 'prefs': [["apz.test.fails_with_native_injection", isWindows]]},
-
- // For the following tests, we want to make sure APZ doesn't wait for a content
- // response that is never going to arrive. To detect this we set the content response
- // timeout to a day, so that the entire test times out and fails if APZ does
- // end up waiting.
- {'file': 'helper_tap_passive.html', 'prefs': [["apz.content_response_timeout", 24 * 60 * 60 * 1000],
- ["apz.test.fails_with_native_injection", isWindows]]},
-
- {'file': 'helper_tap_default_passive.html', 'prefs': [["apz.content_response_timeout", 24 * 60 * 60 * 1000],
- ["apz.test.fails_with_native_injection", isWindows],
- ["dom.event.default_to_passive_touch_listeners", true]]},
-
- // 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},
+ // Add new subtests to test_group_touch_events-3.html, not this file.
];
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);
}