Bug 702093 - Add debugging information to test_bullet_animation mochitest to assist in conquering bug 702093. r=dholbert
authorScott Johnson <sjohnson@mozilla.com>
Mon, 14 Nov 2011 14:19:32 +1300
changeset 80212 05a5faf71deff841e925a9e471efa6e19daf78f5
parent 80211 7ff1026f98809b300e9491fb62c8562e73447782
child 80213 9f2d2db76c5703dd0dc0045539add233a5e40005
push id323
push userrcampbell@mozilla.com
push dateTue, 15 Nov 2011 21:58:36 +0000
treeherderfx-team@3ea216303184 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs702093
milestone11.0a1
Bug 702093 - Add debugging information to test_bullet_animation mochitest to assist in conquering bug 702093. r=dholbert
image/test/mochitest/animationPolling.js
--- 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++;