Bug 1437295 - Ensure that we have a compositor APZ testdata before running the test. r=botond

MozReview-Commit-ID: zV4J3pChIy

--HG--
extra : rebase_source : c4e267f7543525fffda5c27f38b99321e3b9556c
This commit is contained in:
Kartikaya Gupta 2018-03-10 23:26:28 -05:00
Родитель fe4726f972
Коммит 5fe91a90f5
2 изменённых файлов: 25 добавлений и 4 удалений

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

@ -340,6 +340,29 @@ async function waitUntilApzStable() {
await promiseApzRepaintsFlushed();
}
// This function returns a promise that is resolved after at least one paint
// has been sent and processed by the compositor. This function can force
// such a paint to happen if none are pending. This is useful to run after
// the waitUntilApzStable() but before reading the compositor-side APZ test
// data, because the test data for the content layers id only gets populated
// on content layer tree updates *after* the root layer tree has a RefLayer
// pointing to the contnet layer tree. waitUntilApzStable itself guarantees
// that the root layer tree is pointing to the content layer tree, but does
// not guarantee the subsequent paint; this function does that job.
async function forceLayerTreeToCompositor() {
var utils = SpecialPowers.getDOMWindowUtils(window);
if (!utils.isMozAfterPaintPending) {
dump("Forcing a paint since none was pending already...\n");
var testMode = utils.isTestControllingRefreshes;
utils.advanceTimeAndRefresh(0);
if (!testMode) {
utils.restoreNormalRefresh();
}
}
await promiseAllPaintsDone();
await promiseApzRepaintsFlushed();
}
function isApzEnabled() {
var enabled = SpecialPowers.getDOMWindowUtils(window).asyncPanZoomEnabled;
if (!enabled) {

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

@ -26,8 +26,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151663
// --------------------------------------------------------------------
function testBug1151663() {
// Get the content- and compositor-side test data from nsIDOMWindowUtils.
var contentTestData = utils.getContentAPZTestData();
// Get the compositor-side test data from nsIDOMWindowUtils.
var compositorTestData = utils.getCompositorAPZTestData();
// Get the sequence number of the last paint on the compositor side.
@ -39,7 +38,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151663
var lastCompositorPaintSeqNo = lastCompositorPaint.sequenceNumber;
// Convert the test data into a representation that's easier to navigate.
contentTestData = convertTestData(contentTestData);
compositorTestData = convertTestData(compositorTestData);
var paint = compositorTestData.paints[lastCompositorPaintSeqNo];
@ -56,7 +54,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1151663
window.opener.finishTest();
}
waitUntilApzStable().then(testBug1151663);
waitUntilApzStable().then(forceLayerTreeToCompositor).then(testBug1151663);
</script>
</head>
<body style="height: 500px; overflow: scroll">