Bug 1273654 - Merge the subtests from test_basic_pan into test_group_touchevents. r?botond
MozReview-Commit-ID: 4oh88KHfOys
--- a/gfx/layers/apz/test/mochitest/helper_basic_pan.html
+++ b/gfx/layers/apz/test/mochitest/helper_basic_pan.html
@@ -18,18 +18,18 @@ function scrollPage() {
SpecialPowers.Services.obs.addObserver(transformEnd, "APZ:TransformEnd", false);
const TOUCH_SLOP = 1;
synthesizeNativeDrag(document.body, 10, 100, 0, -(50 + TOUCH_SLOP));
dump("Finished native drag, waiting for transform-end observer...\n");
}
function checkScroll() {
- window.opener.is(window.scrollY, 50, "check that the window scrolled");
- window.opener.testDone();
+ is(window.scrollY, 50, "check that the window scrolled");
+ subtestDone();
}
window.onload = function() {
waitForAllPaints(function() {
flushApzRepaints(scrollPage);
});
}
--- a/gfx/layers/apz/test/mochitest/helper_div_pan.html
+++ b/gfx/layers/apz/test/mochitest/helper_div_pan.html
@@ -19,18 +19,18 @@ function scrollOuter() {
const TOUCH_SLOP = 1;
synthesizeNativeDrag(document.getElementById('outer'), 10, 100, 0, -(50 + TOUCH_SLOP));
dump("Finished native drag, waiting for transform-end observer...\n");
}
function checkScroll() {
var outerScroll = document.getElementById('outer').scrollTop;
- window.opener.is(outerScroll, 50, "check that the div scrolled");
- window.opener.testDone();
+ is(outerScroll, 50, "check that the div scrolled");
+ subtestDone();
}
window.onload = function() {
waitForAllPaints(function() {
flushApzRepaints(scrollOuter);
});
}
--- a/gfx/layers/apz/test/mochitest/helper_iframe_pan.html
+++ b/gfx/layers/apz/test/mochitest/helper_iframe_pan.html
@@ -20,18 +20,18 @@ function scrollOuter() {
const TOUCH_SLOP = 1;
synthesizeNativeDrag(outer.contentDocument.body, 10, 100, 0, -(50 + TOUCH_SLOP));
dump("Finished native drag, waiting for transform-end observer...\n");
}
function checkScroll() {
var outerScroll = document.getElementById('outer').contentWindow.scrollY;
- window.opener.is(outerScroll, 50, "check that the iframe scrolled");
- window.opener.testDone();
+ is(outerScroll, 50, "check that the iframe scrolled");
+ subtestDone();
}
window.onload = function() {
waitForAllPaints(function() {
flushApzRepaints(scrollOuter);
});
}
--- a/gfx/layers/apz/test/mochitest/mochitest.ini
+++ b/gfx/layers/apz/test/mochitest/mochitest.ini
@@ -24,20 +24,16 @@ tags = apz
[test_wheel_scroll.html]
skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
[test_wheel_transactions.html]
skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
[test_bug1151667.html]
skip-if = (os == 'android') || (os == 'b2g') # wheel events not supported on mobile
[test_layerization.html]
skip-if = (os == 'android') || (os == 'b2g') # uses wheel events which are not supported on mobile
-[test_basic_pan.html]
-# Windows touch injection doesn't work in automation, but this test can be run locally on a windows touch device.
-# On OS X we don't support touch events at all.
-skip-if = (toolkit == 'windows') || (toolkit == 'cocoa')
[test_scroll_inactive_flattened_frame.html]
skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
[test_scroll_inactive_bug1190112.html]
skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
[test_scroll_subframe_scrollbar.html]
skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
[test_frame_reconstruction.html]
[test_group_touchevents.html]
deleted file mode 100644
--- a/gfx/layers/apz/test/mochitest/test_basic_pan.html
+++ /dev/null
@@ -1,76 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="utf-8">
- <title>Sanity panning test</title>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
- <script type="application/javascript">
-
-SimpleTest.waitForExplicitFinish();
-
-// this page just serially loads each one of the following test helper pages in
-// a new window and waits for it to call testDone()
-var tests = [
- 'helper_basic_pan.html',
- 'helper_div_pan.html',
- 'helper_iframe_pan.html',
-];
-
-var testIndex = -1;
-var w = null;
-
-function testDone() {
- if (w) {
- w.close();
- }
- testIndex++;
- if (testIndex < tests.length) {
- w = window.open(tests[testIndex], "_blank");
- } else {
- SimpleTest.finish();
- }
-}
-
-window.onload = function() {
- if (!SpecialPowers.getDOMWindowUtils(window).asyncPanZoomEnabled) {
- ok(true, "APZ is not enabled, this test is not relevant, sorry!\n");
- SimpleTest.finish();
- return;
- }
- if (!window.TouchEvent) {
- ok(true, "Touch events are not supported on this platform, sorry!\n");
- SimpleTest.finish();
- return;
- }
- SpecialPowers.pushPrefEnv(
- { "set":
- [
- // 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-stop threshold velocity to absurdly high.
- ["apz.fling_stopped_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],
- ]
- }, testDone);
-};
-
- </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
@@ -3,27 +3,58 @@
<head>
<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_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-stop threshold velocity to absurdly high.
+ ["apz.fling_stopped_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 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
{'file': 'helper_tap.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},
+
// For the long-tap test, reduce the content response timeout because the touchstart
// event doesn't get processed (because of the event listener) until this expires.
// Once we support passive event listeners, we can use that instead and stop mucking
// with the timeout.
{'file': 'helper_long_tap.html'},
+
// For the following test, 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]]},
];
SimpleTest.waitForExplicitFinish();