Ensure that 'load' and 'script' tests do layout and painting before we go on to the next test. (Bug 624279) r=roc a2.0=blocking

(It's tempting to remove both the direct call to RecordResult() (and
instead always go through WaitForTestEnd) and the setupPrintMode() call
not inside WaitForTestEnd, but that's probably more than I should tackle
right now.)
This commit is contained in:
L. David Baron 2011-02-02 08:40:17 -08:00
Родитель 037169e1c2
Коммит dd21ec36e9
2 изменённых файлов: 18 добавлений и 12 удалений

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

@ -345,7 +345,7 @@ load 591141.html
asserts(0-1) load 592118.html
load 594808-1.html
asserts(4) load 595435-1.xhtml # bug 610331
!= 595740-1.html about:blank # != rather than load to work around bug 624279
load 595740-1.html
load 603490-1.html
load 603510-1.html
load 604314-1.html

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

@ -966,7 +966,7 @@ const STATE_WAITING_FOR_REFTEST_WAIT_REMOVAL = 1;
const STATE_WAITING_TO_FINISH = 2;
const STATE_COMPLETED = 3;
function WaitForTestEnd(contentRootElement) {
function WaitForTestEnd(contentRootElement, inPrintMode) {
var stopAfterPaintReceived = false;
var state = STATE_WAITING_TO_FIRE_INVALIDATE_EVENT;
@ -1076,9 +1076,11 @@ function WaitForTestEnd(contentRootElement) {
state = STATE_WAITING_FOR_REFTEST_WAIT_REMOVAL;
var hasReftestWait = shouldWaitForReftestWaitRemoval(contentRootElement);
// Notify the test document that now is a good time to test some invalidation
var notification = document.createEvent("Events");
notification.initEvent("MozReftestInvalidate", true, false);
contentRootElement.dispatchEvent(notification);
if (contentRootElement) {
var notification = document.createEvent("Events");
notification.initEvent("MozReftestInvalidate", true, false);
contentRootElement.dispatchEvent(notification);
}
if (hasReftestWait && !shouldWaitForReftestWaitRemoval(contentRootElement)) {
// MozReftestInvalidate handler removed reftest-wait.
// We expect something to have been invalidated...
@ -1100,10 +1102,9 @@ function WaitForTestEnd(contentRootElement) {
return;
}
state = STATE_WAITING_TO_FINISH;
if (doPrintMode(contentRootElement)) {
if (!inPrintMode && doPrintMode(contentRootElement)) {
LogInfo("MakeProgress: setting up print mode");
setupPrintMode();
didPrintMode = true;
}
// Try next state
MakeProgress();
@ -1178,13 +1179,17 @@ function OnDocumentLoad(event)
// we should wait, since this might trigger dispatching of
// MozPaintWait events and make shouldWaitForExplicitPaintWaiters() true
// below.
InitCurrentCanvasWithSnapshot();
var painted = InitCurrentCanvasWithSnapshot();
if (shouldWaitForExplicitPaintWaiters() ||
(!inPrintMode && doPrintMode(contentRootElement))) {
(!inPrintMode && doPrintMode(contentRootElement)) ||
// If we didn't force a paint above, in
// InitCurrentCanvasWithSnapshot, so we should wait for a
// paint before we consider them done.
!painted) {
LogInfo("AfterOnLoadScripts belatedly entering WaitForTestEnd");
// Go into reftest-wait mode belatedly.
WaitForTestEnd(contentRootElement);
WaitForTestEnd(contentRootElement, inPrintMode);
} else {
RecordResult();
}
@ -1196,7 +1201,7 @@ function OnDocumentLoad(event)
// unsuppressed, after the onload event has finished dispatching.
gFailureReason = "timed out waiting for test to complete (trying to get into WaitForTestEnd)";
LogInfo("OnDocumentLoad triggering WaitForTestEnd");
setTimeout(WaitForTestEnd, 0, contentRootElement);
setTimeout(WaitForTestEnd, 0, contentRootElement, inPrintMode);
} else {
if (doPrintMode(contentRootElement)) {
LogInfo("OnDocumentLoad setting up print mode");
@ -1275,7 +1280,7 @@ function InitCurrentCanvasWithSnapshot()
{
if (gURLs[0].type == TYPE_LOAD || gURLs[0].type == TYPE_SCRIPT) {
// We don't want to snapshot this kind of test
return;
return false;
}
if (!gCurrentCanvas) {
@ -1284,6 +1289,7 @@ function InitCurrentCanvasWithSnapshot()
var ctx = gCurrentCanvas.getContext("2d");
DoDrawWindow(ctx, 0, 0, gCurrentCanvas.width, gCurrentCanvas.height);
return true;
}
function roundTo(x, fraction)