зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1273654 - Extract a pushPrefs helper function to simplify test setup. r=botond
The set of changes in this patch removes all waitForFocus calls in the test folder, except for the one in apz_test_utils.js. This results in less boilerplate and more consistent test state initialization. MozReview-Commit-ID: IYlTKDx7Xx2
This commit is contained in:
Родитель
18103f612f
Коммит
93e2c8a220
|
@ -209,6 +209,10 @@ function runSubtestsSeriallyInFreshWindows(aSubtests) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pushPrefs(prefs) {
|
||||||
|
return SpecialPowers.pushPrefEnv({'set': prefs});
|
||||||
|
}
|
||||||
|
|
||||||
function waitUntilApzStable() {
|
function waitUntilApzStable() {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
SimpleTest.waitForFocus(function() {
|
SimpleTest.waitForFocus(function() {
|
||||||
|
|
|
@ -229,9 +229,7 @@ function startTest() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
waitForAllPaints(function() {
|
driveTest();
|
||||||
flushApzRepaints(driveTest);
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
@ -243,12 +241,12 @@ SimpleTest.expectAssertions(0, 8); // we get a bunch of "ASSERTION: Bounds compu
|
||||||
// wheel event as corresponding to a later wheel event.
|
// wheel event as corresponding to a later wheel event.
|
||||||
// Also enable APZ test logging, since we use that data to determine whether
|
// Also enable APZ test logging, since we use that data to determine whether
|
||||||
// a scroll frame was layerized.
|
// a scroll frame was layerized.
|
||||||
SpecialPowers.pushPrefEnv({"set": [["general.smoothScroll", false],
|
pushPrefs([["general.smoothScroll", false],
|
||||||
["apz.displayport_expiry_ms", 0],
|
["apz.displayport_expiry_ms", 0],
|
||||||
["apz.test.logging_enabled", true]]},
|
["apz.test.logging_enabled", true]])
|
||||||
function() {
|
.then(waitUntilApzStable)
|
||||||
SimpleTest.waitForFocus(startTest, window);
|
.then(startTest);
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</pre>
|
</pre>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Test scrolling flattened inactive frames</title>
|
<title>Test scrolling flattened inactive frames</title>
|
||||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||||
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
|
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
|
||||||
|
<script type="application/javascript" src="apz_test_utils.js"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||||
<style>
|
<style>
|
||||||
p {
|
p {
|
||||||
|
@ -526,18 +527,15 @@ function doInnerScrollAgain(subframe, oldpos) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onload = function() {
|
|
||||||
SpecialPowers.pushPrefEnv({
|
|
||||||
'set': [['general.smoothScroll', false],
|
|
||||||
['mousewheel.transaction.timeout', 0],
|
|
||||||
['mousewheel.transaction.ignoremovedelay', 0]]
|
|
||||||
}, function () {
|
|
||||||
SimpleTest.waitForFocus(test);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleTest.testInChaosMode();
|
SimpleTest.testInChaosMode();
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
pushPrefs([['general.smoothScroll', false],
|
||||||
|
['mousewheel.transaction.timeout', 0],
|
||||||
|
['mousewheel.transaction.ignoremovedelay', 0]])
|
||||||
|
.then(waitUntilApzStable)
|
||||||
|
.then(test);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -36,23 +36,14 @@ function test() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function startTest() {
|
|
||||||
waitForAllPaints(function() {
|
|
||||||
flushApzRepaints(test);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
window.onload = function() {
|
|
||||||
SpecialPowers.pushPrefEnv({
|
|
||||||
'set': [['general.smoothScroll', false],
|
|
||||||
['mousewheel.transaction.timeout', 1000000]],
|
|
||||||
}, function () {
|
|
||||||
SimpleTest.waitForFocus(startTest);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleTest.testInChaosMode();
|
SimpleTest.testInChaosMode();
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
pushPrefs([['general.smoothScroll', false],
|
||||||
|
['mousewheel.transaction.timeout', 1000000]])
|
||||||
|
.then(waitUntilApzStable)
|
||||||
|
.then(test);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -104,23 +104,14 @@ function testScrolling(subframe) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function startTest() {
|
|
||||||
waitForAllPaints(function() {
|
|
||||||
flushApzRepaints(test);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
window.onload = function() {
|
|
||||||
SpecialPowers.pushPrefEnv({
|
|
||||||
'set': [['general.smoothScroll', false],
|
|
||||||
['mousewheel.transaction.timeout', 0],
|
|
||||||
['mousewheel.transaction.ignoremovedelay', 0]]
|
|
||||||
}, function () {
|
|
||||||
SimpleTest.waitForFocus(startTest);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
pushPrefs([['general.smoothScroll', false],
|
||||||
|
['mousewheel.transaction.timeout', 0],
|
||||||
|
['mousewheel.transaction.ignoremovedelay', 0]])
|
||||||
|
.then(waitUntilApzStable)
|
||||||
|
.then(test);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -6,7 +6,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1013412
|
||||||
<head>
|
<head>
|
||||||
<title>Test for Bug 1013412</title>
|
<title>Test for Bug 1013412</title>
|
||||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
|
||||||
|
<script type="application/javascript" src="apz_test_utils.js"></script>
|
||||||
<script type="application/javascript" src="apz_test_native_event_utils.js"></script>
|
<script type="application/javascript" src="apz_test_native_event_utils.js"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
<style>
|
<style>
|
||||||
|
@ -99,16 +101,15 @@ function continueTest() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function startTest() {
|
|
||||||
// If we allow smooth scrolling the "smooth" scrolling may cause the page to
|
|
||||||
// glide past the scrollbox (which is supposed to stop the scrolling) and so
|
|
||||||
// we might end up at the bottom of the page.
|
|
||||||
SpecialPowers.pushPrefEnv({"set": [["general.smoothScroll", false]]}, continueTest);
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleTest.testInChaosMode();
|
SimpleTest.testInChaosMode();
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
SimpleTest.waitForFocus(startTest, window);
|
|
||||||
|
// If we allow smooth scrolling the "smooth" scrolling may cause the page to
|
||||||
|
// glide past the scrollbox (which is supposed to stop the scrolling) and so
|
||||||
|
// we might end up at the bottom of the page.
|
||||||
|
pushPrefs([["general.smoothScroll", false]])
|
||||||
|
.then(waitUntilApzStable)
|
||||||
|
.then(continueTest);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
|
@ -132,20 +132,13 @@ function driveTest() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function startTest() {
|
SimpleTest.waitForExplicitFinish();
|
||||||
waitForAllPaints(function() {
|
|
||||||
flushApzRepaints(driveTest);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable smooth scrolling because it makes the test flaky (we don't have a good
|
// Disable smooth scrolling because it makes the test flaky (we don't have a good
|
||||||
// way of detecting when the scrolling is finished).
|
// way of detecting when the scrolling is finished).
|
||||||
SpecialPowers.pushPrefEnv({"set": [["general.smoothScroll", false]]},
|
pushPrefs([["general.smoothScroll", false]])
|
||||||
function() {
|
.then(waitUntilApzStable)
|
||||||
SimpleTest.waitForFocus(startTest, window);
|
.then(driveTest);
|
||||||
});
|
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче