зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1273654 - Extract a helper to check if APZ is enabled or not. r=botond
MozReview-Commit-ID: EkhZpfT3UFs
This commit is contained in:
Родитель
93e2c8a220
Коммит
de9de05549
|
@ -222,3 +222,14 @@ function waitUntilApzStable() {
|
|||
}, window);
|
||||
});
|
||||
}
|
||||
|
||||
function isApzEnabled() {
|
||||
var enabled = SpecialPowers.getDOMWindowUtils(window).asyncPanZoomEnabled;
|
||||
if (!enabled) {
|
||||
// All tests are required to have at least one assertion. Since APZ is
|
||||
// disabled, and the main test is presumably not going to run, we stick in
|
||||
// a dummy assertion here to keep the test passing.
|
||||
SimpleTest.ok(true, "APZ is not enabled; this test will be skipped");
|
||||
}
|
||||
return enabled;
|
||||
}
|
||||
|
|
|
@ -7,25 +7,23 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151663
|
|||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1151663</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">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// Run the actual test in its own window, because it requires that the
|
||||
// root APZC be scrollable. Mochitest pages themselves often run
|
||||
// inside an iframe which means we have no control over the root APZC.
|
||||
var w = null;
|
||||
window.onload = function() {
|
||||
if (!SpecialPowers.getDOMWindowUtils(window).asyncPanZoomEnabled) {
|
||||
ok(true, "APZ is not enabled, this test is not relevant, sorry!\n");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
SpecialPowers.pushPrefEnv({"set": [["apz.test.logging_enabled", true]]}, function() {
|
||||
w = window.open("helper_bug1151663.html", "_blank");
|
||||
});
|
||||
};
|
||||
// Run the actual test in its own window, because it requires that the
|
||||
// root APZC be scrollable. Mochitest pages themselves often run
|
||||
// inside an iframe which means we have no control over the root APZC.
|
||||
var w = null;
|
||||
window.onload = function() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["apz.test.logging_enabled", true]]}, function() {
|
||||
w = window.open("helper_bug1151663.html", "_blank");
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function finishTest() {
|
||||
w.close();
|
||||
|
|
|
@ -7,25 +7,23 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=982141
|
|||
<meta charset="utf-8">
|
||||
<title>Test for Bug 982141</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">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// Run the actual test in its own window, because it requires that the
|
||||
// root APZC not be scrollable. Mochitest pages themselves often run
|
||||
// inside an iframe which means we have no control over the root APZC.
|
||||
var w = null;
|
||||
window.onload = function() {
|
||||
if (!SpecialPowers.getDOMWindowUtils(window).asyncPanZoomEnabled) {
|
||||
ok(true, "APZ is not enabled, this test is not relevant, sorry!\n");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
SpecialPowers.pushPrefEnv({"set": [["apz.test.logging_enabled", true]]}, function() {
|
||||
w = window.open("helper_bug982141.html", "_blank");
|
||||
});
|
||||
};
|
||||
// Run the actual test in its own window, because it requires that the
|
||||
// root APZC not be scrollable. Mochitest pages themselves often run
|
||||
// inside an iframe which means we have no control over the root APZC.
|
||||
var w = null;
|
||||
window.onload = function() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["apz.test.logging_enabled", true]]}, function() {
|
||||
w = window.open("helper_bug982141.html", "_blank");
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function finishTest() {
|
||||
w.close();
|
||||
|
|
|
@ -216,12 +216,8 @@ function driveTest() {
|
|||
}
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var apzEnabled = SpecialPowers.getDOMWindowUtils(window).asyncPanZoomEnabled;
|
||||
if (!apzEnabled) {
|
||||
ok(true, "APZ not enabled, skipping test");
|
||||
SimpleTest.finish();
|
||||
} else {
|
||||
if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.expectAssertions(0, 1); // this test triggers an assertion, see bug 1247050
|
||||
waitUntilApzStable().then(driveTest);
|
||||
}
|
||||
|
|
|
@ -15,16 +15,13 @@ var subtests = [
|
|||
{'file': 'helper_drag_click.html'}
|
||||
];
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
if (!SpecialPowers.getDOMWindowUtils(window).asyncPanZoomEnabled) {
|
||||
ok(true, "APZ is not enabled, this test is not relevant, sorry!\n");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -57,16 +57,13 @@ var subtests = [
|
|||
{'file': 'helper_tap_passive.html', 'prefs': [["apz.content_response_timeout", 24 * 60 * 60 * 1000]]},
|
||||
];
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
if (!SpecialPowers.getDOMWindowUtils(window).asyncPanZoomEnabled) {
|
||||
ok(true, "APZ is not enabled, this test is not relevant, sorry!\n");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -25,16 +25,13 @@ var subtests = [
|
|||
['mousewheel.transaction.timeout', 0]]}
|
||||
];
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
if (!SpecialPowers.getDOMWindowUtils(window).asyncPanZoomEnabled) {
|
||||
ok(true, "APZ is not enabled, this test is not relevant, sorry!\n");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
window.onload = function() {
|
||||
runSubtestsSeriallyInFreshWindows(subtests)
|
||||
.then(SimpleTest.finish);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -220,33 +220,23 @@ function driveTest() {
|
|||
}
|
||||
}
|
||||
|
||||
function startTest() {
|
||||
// This test requires APZ - if it's not enabled, skip it.
|
||||
var apzEnabled = SpecialPowers.getDOMWindowUtils(window).asyncPanZoomEnabled;
|
||||
if (!apzEnabled) {
|
||||
ok(true, "APZ not enabled, skipping test");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
if (isApzEnabled()) {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestFlakyTimeout("we are testing code that measures an actual timeout");
|
||||
SimpleTest.expectAssertions(0, 8); // we get a bunch of "ASSERTION: Bounds computation mismatch" sometimes (bug 1232856)
|
||||
|
||||
driveTest();
|
||||
// Disable smooth scrolling, because it results in long-running scroll
|
||||
// animations that can result in a 'scroll' event triggered by an earlier
|
||||
// wheel event as corresponding to a later wheel event.
|
||||
// Also enable APZ test logging, since we use that data to determine whether
|
||||
// a scroll frame was layerized.
|
||||
pushPrefs([["general.smoothScroll", false],
|
||||
["apz.displayport_expiry_ms", 0],
|
||||
["apz.test.logging_enabled", true]])
|
||||
.then(waitUntilApzStable)
|
||||
.then(driveTest);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestFlakyTimeout("we are testing code that measures an actual timeout");
|
||||
SimpleTest.expectAssertions(0, 8); // we get a bunch of "ASSERTION: Bounds computation mismatch" sometimes (bug 1232856)
|
||||
|
||||
// Disable smooth scrolling, because it results in long-running scroll
|
||||
// animations that can result in a 'scroll' event triggered by an earlier
|
||||
// wheel event as corresponding to a later wheel event.
|
||||
// Also enable APZ test logging, since we use that data to determine whether
|
||||
// a scroll frame was layerized.
|
||||
pushPrefs([["general.smoothScroll", false],
|
||||
["apz.displayport_expiry_ms", 0],
|
||||
["apz.test.logging_enabled", true]])
|
||||
.then(waitUntilApzStable)
|
||||
.then(startTest);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
Загрузка…
Ссылка в новой задаче