Bug 1261158 - Convert test_synchronized_animation.html to a mochitest-plain. r=tnikkel a=test-only
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 04 Apr 2016 16:28:12 -0400
changeset 323797 5f7b05487c5fd23a0164c0273291ae613a8750fb
parent 323796 89da35a833637bbf8cb82fb47eecb4584cdf31c9
child 323798 83314b56489d1bbb02c6af26d5dc31f560b13e94
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel, test-only
bugs1261158
milestone47.0a2
Bug 1261158 - Convert test_synchronized_animation.html to a mochitest-plain. r=tnikkel a=test-only MozReview-Commit-ID: LrftftKDGn6
image/test/mochitest/chrome.ini
image/test/mochitest/mochitest.ini
image/test/mochitest/test_synchronized_animation.html
--- a/image/test/mochitest/chrome.ini
+++ b/image/test/mochitest/chrome.ini
@@ -1,27 +1,24 @@
 [DEFAULT]
 skip-if = buildapp == 'b2g' || os == 'android'
 support-files =
   animated-gif-finalframe.gif
   animated-gif.gif
-  animated1.gif
-  animated2.gif
   animationPolling.js
   iframe.html
   imgutils.js
   ref-iframe.html
   bug1132427.html
   bug1132427.gif
 
 [test_animation.html]
 disabled = bug 1100497
 [test_animation2.html]
 disabled = bug 1101415
 [test_bug415761.html]
 skip-if = os != "win" || os_version == "6.2"
 support-files =
   bug415761.ico
-[test_synchronized_animation.html]
 [test_undisplayed_iframe.html]
 disabled = bug 1060869
 [test_xultree_animation.xhtml]
 [test_bug1132427.html]
--- a/image/test/mochitest/mochitest.ini
+++ b/image/test/mochitest/mochitest.ini
@@ -1,11 +1,13 @@
 [DEFAULT]
 support-files =
   INT32_MIN.bmp
+  animated1.gif
+  animated2.gif
   animated-gif.gif
   animated-gif2.gif
   animated-gif_trailing-garbage.gif
   animated-gif-finalframe.gif
   animation.svg
   animationPolling.js
   bad.jpg
   big.png
@@ -137,8 +139,10 @@ skip-if = buildapp == 'b2g' || os == 'an
 [test_removal_onload.html]
 skip-if = buildapp == 'b2g' || os == 'android'
 [test_staticClone.html]
 skip-if = buildapp == 'b2g' || os == 'android'
 [test_svg_animatedGIF.html]
 skip-if = buildapp == 'b2g' || os == 'android'
 [test_svg_filter_animation.html]
 skip-if = buildapp == 'b2g' || os == 'android'
+[test_synchronized_animation.html]
+skip-if = buildapp == 'b2g' || os == 'android'
--- a/image/test/mochitest/test_synchronized_animation.html
+++ b/image/test/mochitest/test_synchronized_animation.html
@@ -1,56 +1,56 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=867758
 -->
 <head>
   <title>Test for Bug 867758</title>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
   <script type="application/javascript" src="imgutils.js"></script>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=867758">Mozilla Bug 867758</a>
 <p id="display"></p>
 <div id="content">
 </div>
 <pre id="test">
 <script type="application/javascript;version=1.8">
 /** Test for Bug 867758**/
 
+SimpleTest.requestFlakyTimeout("Early failure timeout");
 SimpleTest.waitForExplicitFinish();
 
 const FAILURE_TIMEOUT = 120000; // Fail early after 120 seconds (2 minutes)
 
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
+const Cc = SpecialPowers.Cc;
+const Ci = SpecialPowers.Ci;
 const gContent = document.getElementById("content");
 
 var gDispatched = false;
 var gRanEvent = false;
 var gObserver;
 var gImg1;
 var gImg2;
 var gFirstImageLoaded = false;
 var gOuter;
 var gFinished = false;
 var gFirstRequest = null;
 
 function cleanUpAndFinish() {
   if (gFinished) {
     return;
   }
-  var imgLoadingContent = gImg1.QueryInterface(Ci.nsIImageLoadingContent);
+  var imgLoadingContent = SpecialPowers.wrap(gImg1).QueryInterface(Ci.nsIImageLoadingContent);
   imgLoadingContent.removeObserver(gOuter);
 
-  imgLoadingContent = gImg2.QueryInterface(Ci.nsIImageLoadingContent);
+  imgLoadingContent = SpecialPowers.wrap(gImg2).QueryInterface(Ci.nsIImageLoadingContent);
   imgLoadingContent.removeObserver(gOuter);
 
   SimpleTest.finish();
 
   gFinished = true;
 }
 
 function frameUpdate(aRequest) {
@@ -74,17 +74,17 @@ function failTest() {
 function waitForLoadAndTest(image) {
   return () => {
     // Draw the image into a canvas to ensure it's decoded.
     var canvas = document.createElement('canvas');
     var context = canvas.getContext('2d');
     context.drawImage(image, 0, 0);
 
     // Attach the observer.
-    var imgLoadingContent = image.QueryInterface(Ci.nsIImageLoadingContent);
+    var imgLoadingContent = SpecialPowers.wrap(image).QueryInterface(Ci.nsIImageLoadingContent);
     imgLoadingContent.addObserver(gOuter);
 
     // If the other image already loaded, add both images to the document, which
     // begins the real test.
     if (gFirstImageLoaded) {
       gContent.appendChild(gImg1);
       gContent.appendChild(gImg2);
     } else {
@@ -96,17 +96,17 @@ function waitForLoadAndTest(image) {
 function main() {
   gImg1 = new Image();
   gImg2 = new Image();
 
   // Create and customize decoder observer
   var obs = new ImageDecoderObserverStub();
   obs.frameUpdate = frameUpdate;
 
-  gOuter = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools).createScriptedObserver(obs);
+  gOuter = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools).createScriptedObserver(SpecialPowers.wrapCallbackObject(obs));
 
   // We want to test the cold loading behavior, so clear cache in case an
   // earlier test got our image in there already.
   clearAllImageCaches();
 
   // These are two copies of the same image; hence, they have the same frame rate.
   gImg1.src = "animated1.gif";
   gImg2.src = "animated2.gif";