Bug 1374166 - Use waitUntilApzStable to increase test robustness. r=botond

The important part here is that the test parent page
(test_bug1151663.html) waits for paints to complete before spawning the
helper window. Otherwise, the helper window might think it's done
painting (because it is) and start running the test even though its
layer tree has not been attached to the chrome layer tree. In such a
scenario reading the APZ test data produces an empty tree for the
content layers id and causes the test to fail.

This test was written before we had waitUntilApzStable so sprinkling some
of that into the test makes it more robust in general as well.

MozReview-Commit-ID: J8rqW6dcy23

--HG--
extra : rebase_source : f9e28bd15f355c88649ff1797b1f1205824bf815
This commit is contained in:
Kartikaya Gupta 2018-02-09 12:29:21 -05:00
Родитель 0da87323d2
Коммит f6bd1624da
2 изменённых файлов: 9 добавлений и 20 удалений

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

@ -7,28 +7,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151663
<meta charset="utf-8">
<title>Test for Bug 1151663, helper page</title>
<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">
// -------------------------------------------------------------------
// Infrastructure to get the test assertions to run at the right time.
// -------------------------------------------------------------------
var SimpleTest = window.opener.SimpleTest;
window.onload = function() {
window.addEventListener("MozAfterPaint", afterPaint);
};
var utils = SpecialPowers.getDOMWindowUtils(window);
function afterPaint(e) {
// If there is another paint pending, wait for it.
if (utils.isMozAfterPaintPending) {
return;
}
// Once there are no more paints pending, remove the
// MozAfterPaint listener and run the test logic.
window.removeEventListener("MozAfterPaint", afterPaint);
testBug1151663();
}
// --------------------------------------------------------------------
// The actual logic for testing bug 1151663.
@ -69,6 +55,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151663
window.opener.finishTest();
}
waitUntilApzStable().then(testBug1151663);
</script>
</head>
<body style="height: 500px; overflow: scroll">

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

@ -8,6 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151663
<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>
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
@ -18,11 +19,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151663
// 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() {
pushPrefs([["apz.test.logging_enabled", true]]).then(function() {
w = window.open("helper_bug1151663.html", "_blank");
});
};
pushPrefs([["apz.test.logging_enabled", true]])
.then(waitUntilApzStable)
.then(function() {
w = window.open("helper_bug1151663.html", "_blank");
});
}
function finishTest() {