Bug 1264017 - Add a basic sanity mouse click synthesization test. r=botond
MozReview-Commit-ID: LTsnN3fcQQ7
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_click.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width; initial-scale=1.0">
+ <title>Sanity mouse-clicking test</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 clickButton() {
+ document.addEventListener('click', clicked, false);
+
+ synthesizeNativeClick(document.getElementById('b'), 5, 5, function() {
+ dump("Finished synthesizing click, waiting for button to be clicked...\n");
+ });
+}
+
+function clicked(e) {
+ window.opener.is(e.target, document.getElementById('b'), "Clicked on button, yay! (at " + e.clientX + "," + e.clientY + ")");
+ window.opener.testDone();
+}
+
+window.onload = function() {
+ waitForAllPaints(function() {
+ flushApzRepaints(clickButton);
+ });
+}
+
+ </script>
+</head>
+<body>
+ <button id="b" style="width: 10px; height: 10px"></button>
+</body>
+</html>
--- a/gfx/layers/apz/test/mochitest/mochitest.ini
+++ b/gfx/layers/apz/test/mochitest/mochitest.ini
@@ -10,16 +10,17 @@ support-files =
helper_basic_pan.html
helper_div_pan.html
helper_iframe_pan.html
helper_scrollto_tap.html
helper_tap.html
helper_long_tap.html
helper_scroll_on_position_fixed.html
helper_tap_passive.html
+ helper_click.html
tags = apz
[test_bug982141.html]
[test_bug1151663.html]
[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]
@@ -38,8 +39,11 @@ skip-if = (os == 'android') || (os == 'b
skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
[test_frame_reconstruction.html]
[test_tap.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_window.html]
skip-if = (toolkit == 'android') # wheel events not supported on mobile
+[test_click.html]
+# Very similar to test_tap, but we don't yet have mouse event synthesization on android
+skip-if = (os == 'android')
copy from gfx/layers/apz/test/mochitest/test_tap.html
copy to gfx/layers/apz/test/mochitest/test_click.html
--- a/gfx/layers/apz/test/mochitest/test_tap.html
+++ b/gfx/layers/apz/test/mochitest/test_click.html
@@ -1,37 +1,24 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
- <title>Sanity panning test</title>
+ <title>Sanity clicking 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 = [
- {'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]]},
+ // Sanity test to synthesize a mouse click
+ {'file': 'helper_click.html'}
];
var testIndex = -1;
var w = null;
function testDone() {
var test = tests[testIndex];
if (w) {
--- a/gfx/layers/apz/test/mochitest/test_tap.html
+++ b/gfx/layers/apz/test/mochitest/test_tap.html
@@ -1,13 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
- <title>Sanity panning test</title>
+ <title>Sanity tapping 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()