Bug 1269209 - Port test_bug1140105.html from chrome to plain; r=masayuki
authorAryeh Gregor <ayg@aryeh.name>
Mon, 31 Oct 2016 18:11:21 +0200
changeset 432268 3e54ecf6669ce0f960c25dafc4b29ba53efe3da2
parent 432267 c2e81e5adf55c90b482ed65bcabf4fc489403ee9
child 432269 100dac64a19abf0aadb4f1fcf246c6fbbaf96e47
push id34240
push userbmo:ttromey@mozilla.com
push dateTue, 01 Nov 2016 14:41:32 +0000
reviewersmasayuki
bugs1269209, 1140105
milestone52.0a1
Bug 1269209 - Port test_bug1140105.html from chrome to plain; r=masayuki MozReview-Commit-ID: BfdjmtEdwX4
editor/libeditor/tests/chrome.ini
editor/libeditor/tests/mochitest.ini
editor/libeditor/tests/test_bug1140105.html
--- a/editor/libeditor/tests/chrome.ini
+++ b/editor/libeditor/tests/chrome.ini
@@ -12,17 +12,16 @@ skip-if = buildapp == 'mulet'
 [test_bug607584.xul]
 [test_bug616590.xul]
 [test_bug636465.xul]
 [test_bug646194.xul]
 [test_bug780908.xul]
 [test_bug1102906.html]
 [test_bug1101392.html]
 subsuite = clipboard
-[test_bug1140105.html]
 [test_bug1140617.xul]
 subsuite = clipboard
 [test_bug1153237.html]
 [test_bug1154791.html]
 [test_bug1248128.html]
 [test_bug1248185.html]
 [test_bug1250010.html]
 [test_bug1257363.html]
--- a/editor/libeditor/tests/mochitest.ini
+++ b/editor/libeditor/tests/mochitest.ini
@@ -169,16 +169,17 @@ skip-if = os != "win"
 skip-if = os != "win"
 [test_bug998188.html]
 [test_bug1026397.html]
 [test_bug1053048.html]
 [test_bug1067255.html]
 [test_bug1094000.html]
 [test_bug1100966.html]
 skip-if = os == 'android'
+[test_bug1140105.html]
 [test_CF_HTML_clipboard.html]
 subsuite = clipboard
 [test_contenteditable_focus.html]
 [test_dom_input_event_on_htmleditor.html]
 skip-if = toolkit == 'android' # bug 1054087
 [test_dom_input_event_on_texteditor.html]
 [test_keypress_untrusted_event.html]
 [test_root_element_replacement.html]
--- a/editor/libeditor/tests/test_bug1140105.html
+++ b/editor/libeditor/tests/test_bug1140105.html
@@ -1,18 +1,18 @@
 <!DOCTYPE>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=1140105
 -->
 <head>
   <title>Test for Bug 1140105</title>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+  <script src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" href="/tests/SimpleTest/test.css">
+  <script src="/tests/SimpleTest/EventUtils.js"></script>
 </head>
 <body>
 <div id="display">
 </div>
 
 <div id="content" contenteditable><font face="Arial">1234567890</font></div>
 
 <pre id="test">
@@ -33,34 +33,35 @@ SimpleTest.waitForFocus(function() {
   is(selRange.endContainer.nodeName, "#text", "selection should be in text node");
   is(selRange.endOffset, 9, "offset should be 9");
 
   var firstHas = {};
   var anyHas = {};
   var allHas = {};
   var editor = getEditor();
 
-  var atomService = Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService);
+  var atomService = SpecialPowers.Cc["@mozilla.org/atom-service;1"].getService(SpecialPowers.Ci.nsIAtomService);
   var propAtom = atomService.getAtom("font");
   editor.getInlineProperty(propAtom, "face", "Arial", firstHas, anyHas, allHas);
   is(firstHas.value, true, "Test for Arial: firstHas: true expected");
   is(anyHas.value, true, "Test for Arial: anyHas: true expected");
   is(allHas.value, true, "Test for Arial: allHas: true expected");
   editor.getInlineProperty(propAtom, "face", "Courier", firstHas, anyHas, allHas);
   is(firstHas.value, false, "Test for Courier: firstHas: false expected");
   is(anyHas.value, false, "Test for Courier: anyHas: false expected");
   is(allHas.value, false, "Test for Courier: allHas: false expected");
 
   SimpleTest.finish();
 
 });
 
 function getEditor() {
-  var Ci = Components.interfaces;
-  var editingSession = window.QueryInterface(Ci.nsIInterfaceRequestor)
+  var Ci = SpecialPowers.Ci;
+  var editingSession = SpecialPowers.wrap(window)
+                             .QueryInterface(Ci.nsIInterfaceRequestor)
                              .getInterface(Ci.nsIWebNavigation)
                              .QueryInterface(Ci.nsIInterfaceRequestor)
                              .getInterface(Ci.nsIEditingSession);
   var editor = editingSession.getEditorForWindow(window);
   editor.QueryInterface(Ci.nsIHTMLEditor);
   return editor;
 }