Bug 1256210 - Part 2: Convert test_additional_sheets.html and test_addSheets.html to mochitest-plain. r=dbaron
authorCameron McCormack <cam@mcc.id.au>
Thu, 17 Mar 2016 13:17:10 +1100
changeset 312888 5d01a67037fbb2b1dfec6f8388bedcfc5b429410
parent 312887 81cc69f9295fbdcdcee1f07f30ceac4c694d6e2f
child 312889 a07bf6b78039a0efd2483b7cebf21a700b244f93
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1256210
milestone48.0a1
Bug 1256210 - Part 2: Convert test_additional_sheets.html and test_addSheets.html to mochitest-plain. r=dbaron
layout/style/test/additional_sheets_helper.html
layout/style/test/chrome/additional_sheets_helper.html
layout/style/test/chrome/chrome.ini
layout/style/test/chrome/test_addSheet.html
layout/style/test/chrome/test_additional_sheets.html
layout/style/test/mochitest.ini
layout/style/test/moz.build
layout/style/test/test_addSheet.html
layout/style/test/test_additional_sheets.html
rename from layout/style/test/chrome/additional_sheets_helper.html
rename to layout/style/test/additional_sheets_helper.html
--- a/layout/style/test/chrome/chrome.ini
+++ b/layout/style/test/chrome/chrome.ini
@@ -4,18 +4,16 @@ support-files =
   bug418986-2.js
   bug535806-css.css
   bug535806-html.html
   bug535806-xul.xul
   hover_helper.html
   match.png
   mismatch.png
 
-[test_addSheet.html]
-[test_additional_sheets.html]
 [test_author_specified_style.html]
 [test_bug418986-2.xul]
 [test_bug1157097.html]
 [test_bug1160724.xul]
 [test_bug535806.xul]
 [test_display_mode.html]
 tags = fullscreen
 [test_hover.html]
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -29,16 +29,20 @@ support-files =
   visited_image_loading_frame_empty.html
   visited_image_loading_frame.html
   visited_image_loading.sjs
   visited-lying-inner.html
   visited-pref-iframe.html
   xbl_bindings.xml
 
 [test_acid3_test46.html]
+[test_addSheet.html]
+support-files = additional_sheets_helper.html
+[test_additional_sheets.html]
+support-files = additional_sheets_helper.html
 [test_all_shorthand.html]
 [test_animations.html]
 skip-if = toolkit == 'android'
 [test_animations_async_tests.html]
 support-files = ../../reftests/fonts/Ahem.ttf file_animations_async_tests.html
 [test_animations_dynamic_changes.html]
 [test_animations_effect_timing_duration.html]
 support-files = file_animations_effect_timing_duration.html
--- a/layout/style/test/moz.build
+++ b/layout/style/test/moz.build
@@ -28,17 +28,16 @@ HostSimplePrograms([
 MOCHITEST_MANIFESTS += [
     'mochitest.ini',
 ]
 XPCSHELL_TESTS_MANIFESTS += ['xpcshell.ini']
 BROWSER_CHROME_MANIFESTS += ['browser.ini']
 MOCHITEST_CHROME_MANIFESTS += ['chrome/chrome.ini']
 
 TEST_HARNESS_FILES.testing.mochitest.tests.layout.style.test.chrome += [
-    'chrome/additional_sheets_helper.html',
     'chrome/moz_document_helper.html',
 ]
 
 TEST_HARNESS_FILES.testing.mochitest.tests.layout.style.test['css-visited'] += [
     '/layout/reftests/css-visited/border-1-ref.html',
     '/layout/reftests/css-visited/border-1.html',
     '/layout/reftests/css-visited/border-2-ref.html',
     '/layout/reftests/css-visited/border-2a.html',
rename from layout/style/test/chrome/test_addSheet.html
rename to layout/style/test/test_addSheet.html
--- a/layout/style/test/chrome/test_addSheet.html
+++ b/layout/style/test/test_addSheet.html
@@ -1,43 +1,43 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for addSheet</title>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body onload="run()">
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1024707">Mozilla Bug 1024707</a>
 
-<iframe id="iframe1" src="http://mochi.test:8888/tests/layout/style/test/chrome/additional_sheets_helper.html"></iframe>
-<iframe id="iframe2" src="http://mochi.test:8888/tests/layout/style/test/chrome/additional_sheets_helper.html"></iframe>
+<iframe id="iframe1" src="additional_sheets_helper.html"></iframe>
+<iframe id="iframe2" src="additional_sheets_helper.html"></iframe>
 
 <pre id="test">
 <script type="application/javascript; version=1.8">
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
-let IO = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
+let gIOService = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
+  .getService(SpecialPowers.Ci.nsIIOService);
 
-let service = Cc["@mozilla.org/content/style-sheet-service;1"]
-                .getService(Ci.nsIStyleSheetService);
+let gSSService = SpecialPowers.Cc["@mozilla.org/content/style-sheet-service;1"]
+  .getService(SpecialPowers.Ci.nsIStyleSheetService);
 
 function test(win, sheet) {
     let cs = win.getComputedStyle(win.document.body, null);
     is(cs.getPropertyValue('color'), "rgb(0, 0, 0)", "should have default color");
-    var windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
-                         .getInterface(Ci.nsIDOMWindowUtils);
-    windowUtils.addSheet(sheet, Ci.nsIDOMWindowUtils.USER_SHEET);
+    var windowUtils = SpecialPowers.wrap(win)
+      .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
+      .getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
+    windowUtils.addSheet(sheet, SpecialPowers.Ci.nsIDOMWindowUtils.USER_SHEET);
     is(cs.getPropertyValue('color'), "rgb(255, 0, 0)", "should have changed color to red");
 }
 
 function run() {
-    var uri = IO.newURI("data:text/css,body{color:red;}", null, null);
-    let sheet = service.preloadSheet(uri, Ci.nsIStyleSheetService.USER_SHEET);
+    var uri = gIOService.newURI("data:text/css,body{color:red;}", null, null);
+    let sheet = gSSService.preloadSheet(uri, SpecialPowers.Ci.nsIStyleSheetService.USER_SHEET);
 
     test(document.getElementById("iframe1").contentWindow, sheet);
     test(document.getElementById("iframe2").contentWindow, sheet);
 
     SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
rename from layout/style/test/chrome/test_additional_sheets.html
rename to layout/style/test/test_additional_sheets.html
--- a/layout/style/test/chrome/test_additional_sheets.html
+++ b/layout/style/test/test_additional_sheets.html
@@ -1,29 +1,26 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Test for additional sheets</title>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body onload="run()">
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=737003">Mozilla Bug 737003</a>
-<iframe id="iframe" src="http://mochi.test:8888/tests/layout/style/test/chrome/additional_sheets_helper.html"></iframe>
+<iframe id="iframe" src="additional_sheets_helper.html"></iframe>
 <pre id="test">
 <script type="application/javascript; version=1.8">
 
-
+var gIOService = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
+  .getService(SpecialPowers.Ci.nsIIOService)
 
-var gIOService = Components.classes["@mozilla.org/network/io-service;1"]
-  .getService(Components.interfaces.nsIIOService)
-
-var gSSService = Components.classes["@mozilla.org/content/style-sheet-service;1"]
-    .getService(Components.interfaces.nsIStyleSheetService);
+var gSSService = SpecialPowers.Cc["@mozilla.org/content/style-sheet-service;1"]
+  .getService(SpecialPowers.Ci.nsIStyleSheetService);
 
 function getUri(style)
 {
   return "data:text/css," + style;
 }
 
 function getStyle(color, swapped)
 {
@@ -59,26 +56,28 @@ function removeAgentSheet(win, style)
 function removeAuthorSheet(win, style)
 {
   removeSheet(win, style, "AUTHOR_SHEET");
 }
 
 function loadSheet(win, style, type)
 {
   var uri = gIOService.newURI(getUri(style), null, null);
-  var windowUtils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
-    .getInterface(Components.interfaces.nsIDOMWindowUtils);
+  var windowUtils = SpecialPowers.wrap(win)
+    .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
+    .getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
   windowUtils.loadSheet(uri, windowUtils[type]);
 }
 
 function removeSheet(win, style, type)
 {
   var uri = gIOService.newURI(getUri(style), null, null);
-  var windowUtils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
-    .getInterface(Components.interfaces.nsIDOMWindowUtils);
+  var windowUtils = SpecialPowers.wrap(win)
+    .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
+    .getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
   windowUtils.removeSheet(uri, windowUtils[type]);
 }
 
 function loadAndRegisterUserSheet(win, style)
 {
   loadAndRegisterSheet(win, style, "USER_SHEET");
 }