Bug 1261158 - Convert test_has_transparency.html to a mochitest-plain. r=tnikkel a=test-only
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 04 Apr 2016 16:27:58 -0400
changeset 323790 52e8688505bfd726ef525ed42f64446173a4f3e0
parent 323789 1c55cc5933248908b36214c70171763f69475ae0
child 323791 ae532d54b3fe11bcf98683d377252807409671cb
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_has_transparency.html to a mochitest-plain. r=tnikkel a=test-only MozReview-Commit-ID: 9tR3LH4wg4U
image/test/mochitest/chrome.ini
image/test/mochitest/mochitest.ini
image/test/mochitest/test_has_transparency.html
--- a/image/test/mochitest/chrome.ini
+++ b/image/test/mochitest/chrome.ini
@@ -6,42 +6,34 @@ support-files =
   animated1.gif
   animated2.gif
   animation.svg
   animationPolling.js
   bad.jpg
   damon.jpg
   filter-final.svg
   filter.svg
-  first-frame-padding.gif
-  ico-bmp-opaque.ico
-  ico-bmp-transparent.ico
   iframe.html
   imgutils.js
   invalid.jpg
   lime100x100.svg
-  opaque.bmp
-  red.gif
   red.png
   ref-iframe.html
   rillybad.jpg
-  transparent.gif
-  transparent.png
   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_has_transparency.html]
 [test_net_failedtoprocess.html]
 [test_removal_ondecode.html]
 [test_removal_onload.html]
 [test_staticClone.html]
 [test_svg_animatedGIF.html]
 [test_svg_filter_animation.html]
 [test_synchronized_animation.html]
 [test_undisplayed_iframe.html]
--- a/image/test/mochitest/mochitest.ini
+++ b/image/test/mochitest/mochitest.ini
@@ -36,35 +36,42 @@ support-files =
   bug1180105-waiter.sjs
   bug1217571-iframe.html
   clear.gif
   clear.png
   clear2.gif
   clear2-results.gif
   damon.jpg
   error-early.png
+  first-frame-padding.gif
   green.png
   green-background.html
   grey.png
+  ico-bmp-opaque.ico
+  ico-bmp-transparent.ico
   imgutils.js
   invalid.jpg
   keep.gif
   keep.png
   lime100x100.svg
   lime-anim-100x100.svg
   lime-anim-100x100-2.svg
+  opaque.bmp
   purple.gif
+  red.gif
   red.png
   restore-previous.gif
   restore-previous.png
   rillybad.jpg
   schrep.png
   shaver.png
   short_header.gif
   source.png
+  transparent.gif
+  transparent.png
   over.png
   6M-pixels.png
   12M-pixels-1.png
   12M-pixels-2.png
 
 [test_ImageContentLoaded.html]
 [test_bug399925.html]
 skip-if = buildapp == 'b2g' && debug # Bug 1182951
@@ -113,8 +120,10 @@ skip-if = buildapp == 'b2g' || os == 'an
 [test_background_image_anim.html]
 skip-if = buildapp == 'b2g' || os == 'android'
 [test_bullet_animation.html]
 skip-if = buildapp == 'b2g' || os == 'android'
 [test_changeOfSource.html]
 skip-if = buildapp == 'b2g' || os == 'android'
 [test_changeOfSource2.html]
 skip-if = buildapp == 'b2g' || os == 'android'
+[test_has_transparency.html]
+skip-if = buildapp == 'b2g' || os == 'android'
--- a/image/test/mochitest/test_has_transparency.html
+++ b/image/test/mochitest/test_has_transparency.html
@@ -1,35 +1,36 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1089880
 -->
 <head>
   <title>Test for Bug 1089880</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=1089880">Mozilla Bug 1089880</a>
 <p id="display"></p>
 <div id="content">
 </div>
 <pre id="test">
 <script type="application/javascript;version=1.8">
 /** Test for Bug 1089880 **/
 
+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 Cc = SpecialPowers.Cc;
+const Ci = SpecialPowers.Ci;
 const gContent = document.getElementById("content");
 
 var gCanvas;
 var gCanvasCtx;
 var gImg;
 var gMyDecoderObserver;
 var gIsTestFinished = false;
 var gFiles;
@@ -119,17 +120,17 @@ function failTest() {
   cleanUpAndFinish();
 }
 
 function cleanUpAndFinish() {
   if (gIsTestFinished) {
     return;
   }
   gIsTestFinished = true;
-  let imgLoadingContent = gImg.QueryInterface(Ci.nsIImageLoadingContent);
+  let imgLoadingContent = SpecialPowers.wrap(gImg).QueryInterface(Ci.nsIImageLoadingContent);
   imgLoadingContent.removeObserver(gMyDecoderObserver);
   SimpleTest.finish();
 }
 
 function main() {
   gFiles = testFiles();
   gCanvas = document.createElement('canvas');
   gCanvasCtx = gCanvas.getContext('2d');
@@ -138,18 +139,18 @@ function main() {
   gImg.onerror = onError;
 
   // Create, customize & attach decoder observer.
   observer = new ImageDecoderObserverStub();
   observer.hasTransparency = onHasTransparency;
   observer.decodeComplete = onDecodeComplete;
   gMyDecoderObserver =
     Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
-      .createScriptedObserver(observer);
-  let imgLoadingContent = gImg.QueryInterface(Ci.nsIImageLoadingContent);
+      .createScriptedObserver(SpecialPowers.wrapCallbackObject(observer));
+  let imgLoadingContent = SpecialPowers.wrap(gImg).QueryInterface(Ci.nsIImageLoadingContent);
   imgLoadingContent.addObserver(gMyDecoderObserver);
 
   // We want to test the cold loading behavior, so clear cache in case an
   // earlier test got our image in there already.
   clearAllImageCaches();
 
   // Load the first image.
   loadNext();