Bug 702093 - Add debugging information to test_bullet_animation mochitest to assist in conquering
bug 702093. r=dholbert
--- a/image/test/mochitest/animationPolling.js
+++ b/image/test/mochitest/animationPolling.js
@@ -31,20 +31,26 @@ function reuseImageCallback()
function failTest ()
{
if (currentTest.isTestFinished || currentTest.closeFunc) {
return;
}
ok(false, "timing out after " + currentTest.timeout + "ms. "
- + "Animated image still doesn't look correct, " + "after call #"
- + currentTest.onStopFrameCounter + " to onStopFrame");
+ + "Animated image still doesn't look correct, after poll #"
+ + currentTest.pollCounter);
currentTest.wereFailures = true;
+ if (currentTest.currentSnapshotDataURI) {
+ currentTest.outputDebugInfo("Snapshot #" + currentTest.pollCounter,
+ "snapNum" + currentTest.pollCounter,
+ currentTest.currentSnapshotDataURI);
+ }
+
currentTest.enableDisplay(document.getElementById(currentTest.debugElementId));
currentTest.cleanUpAndFinish();
};
/**
* Create a new AnimationTest object.
*
@@ -91,17 +97,17 @@ function AnimationTest(pollFreq, timeout
// indicates the source of the image they want to change to,
// after the reference image has been taken.
this.reusingImageAsReference = true;
}
this.srcAttr = srcAttr;
this.debugElementId = debugElementId;
this.referenceSnapshot = ""; // value will be set in takeReferenceSnapshot()
- this.onStopFrameCounter = 0;
+ this.pollCounter = 0;
this.isTestFinished = false;
this.numRefsTaken = 0;
this.blankWaitTime = 0;
this.cleanId = cleanId ? cleanId : '';
this.xulTest = xulTest ? xulTest : '';
this.closeFunc = closeFunc ? closeFunc : '';
@@ -119,16 +125,17 @@ AnimationTest.prototype.outputDebugInfo
var debugElement = document.getElementById(this.debugElementId);
var newDataUriElement = document.createElement("a");
newDataUriElement.setAttribute("id", id);
newDataUriElement.setAttribute("href", dataUri);
newDataUriElement.appendChild(document.createTextNode(message));
debugElement.appendChild(newDataUriElement);
var brElement = document.createElement("br");
debugElement.appendChild(brElement);
+ todo(false, "Debug (" + id + "): " + message + " " + dataUri);
};
AnimationTest.prototype.isFinished = function()
{
return this.isTestFinished;
};
AnimationTest.prototype.takeCleanSnapshot = function()
@@ -194,24 +201,22 @@ AnimationTest.prototype.beginTest = func
AnimationTest.prototype.setupPolledImage = function ()
{
// Make sure the image is visible
if (!this.reusingImageAsReference) {
this.enableDisplay(document.getElementById(this.imageElementId));
var currentSnapshot = snapshotWindow(window, false);
var result = compareSnapshots(currentSnapshot, this.referenceSnapshot, true);
- var dataString = "Snapshot #" + this.onStopFrameCounter;
- this.outputDebugInfo(dataString, 'snap' + this.onStopFrameCounter,
- currentSnapshot.toDataURL());
+ this.currentSnapshotDataURI = currentSnapshot.toDataURL();
if (result[0]) {
// SUCCESS!
- ok(true, "Animated image looks correct, " + "at call #"
- + this.onStopFrameCounter + " to onStopFrame");
+ ok(true, "Animated image looks correct, at poll #"
+ + this.pollCounter);
this.cleanUpAndFinish();
}
} else {
if (!gIsRefImageLoaded) {
this.myImage = new Image();
this.myImage.onload = reuseImageCallback;
document.getElementById(this.imageElementId).setAttribute('src',
@@ -221,35 +226,33 @@ AnimationTest.prototype.setupPolledImage
}
AnimationTest.prototype.checkImage = function ()
{
if (this.isTestFinished) {
return;
}
- this.onStopFrameCounter++;
+ this.pollCounter++;
// We need this for some tests, because we need to force the
// test image to be visible.
if (!this.reusingImageAsReference) {
this.enableDisplay(document.getElementById(this.imageElementId));
}
var currentSnapshot = snapshotWindow(window, false);
var result = compareSnapshots(currentSnapshot, this.referenceSnapshot, true);
- var dataString = "Snapshot #" + this.onStopFrameCounter;
- this.outputDebugInfo(dataString, 'snap' + this.onStopFrameCounter,
- currentSnapshot.toDataURL());
+ this.currentSnapshotDataURI = currentSnapshot.toDataURL();
if (result[0]) {
// SUCCESS!
- ok(true, "Animated image looks correct, " + "at call #"
- + this.onStopFrameCounter + " to onStopFrame");
+ ok(true, "Animated image looks correct, at poll #"
+ + this.pollCounter);
this.cleanUpAndFinish();
}
};
AnimationTest.prototype.takeReferenceSnapshot = function ()
{
this.numRefsTaken++;