Bug 1264017 - Add a basic sanity mouse click synthesization test. r=botond

MozReview-Commit-ID: Gv6QQrF2T7d

--HG--
rename : gfx/layers/apz/test/mochitest/test_tap.html => gfx/layers/apz/test/mochitest/test_click.html
This commit is contained in:
Kartikaya Gupta 2016-05-16 12:17:17 -04:00
Родитель 392f87445d
Коммит 57664be4cf
4 изменённых файлов: 122 добавлений и 1 удалений

Просмотреть файл

@ -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>

Просмотреть файл

@ -15,6 +15,7 @@ support-files =
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]
@ -43,3 +44,6 @@ skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel ev
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')

Просмотреть файл

@ -0,0 +1,81 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<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 = [
// 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) {
if (typeof test.dp_suppression != 'undefined') {
// We modified the suppression when starting the test, so now undo that.
SpecialPowers.getDOMWindowUtils(window).respectDisplayPortSuppression(!test.dp_suppression);
}
if (!!test.prefs) {
// We pushed some prefs for this test, pop them, and re-invoke
// testDone() after that's been processed
SpecialPowers.popPrefEnv(function() {
w.close();
w = null;
testDone();
});
return;
}
w.close();
}
testIndex++;
if (testIndex >= tests.length) {
SimpleTest.finish();
return;
}
test = tests[testIndex];
if (typeof test.dp_suppression != 'undefined') {
// Normally during a test, the displayport will get suppressed during page
// load, and unsuppressed at a non-deterministic time during the test. The
// unsuppression can trigger a repaint which interferes with the test, so
// to avoid that we can force the displayport to be unsuppressed for the
// entire test which is more deterministic.
SpecialPowers.getDOMWindowUtils(window).respectDisplayPortSuppression(test.dp_suppression);
}
if (!!test.prefs) {
// Got some prefs for this subtest, push them
SpecialPowers.pushPrefEnv({"set": test.prefs}, function() {
w = window.open(test.file, "_blank");
});
} else {
w = window.open(test.file, "_blank");
}
}
window.onload = function() {
if (!SpecialPowers.getDOMWindowUtils(window).asyncPanZoomEnabled) {
ok(true, "APZ is not enabled, this test is not relevant, sorry!\n");
SimpleTest.finish();
return;
}
testDone();
};
</script>
</head>
<body>
</body>
</html>

Просмотреть файл

@ -2,7 +2,7 @@
<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">