Bug 1271119 - Port test_bug646194.xul from chrome to mochitest; r=masayuki
authorAryeh Gregor <ayg@aryeh.name>
Tue, 30 Aug 2016 18:40:55 +0300
changeset 347280 ae9a33708ecce23b67b973e654f9a43edbf872f5
parent 347279 8fe257d9c2438ecc15160c3229b25042a5ba3026
child 347281 1da8e3d851c6f0372cda50f01c9d93fd60aa358c
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1271119, 646194
milestone52.0a1
Bug 1271119 - Port test_bug646194.xul from chrome to mochitest; r=masayuki MozReview-Commit-ID: Lx05BEKQiwO
editor/libeditor/tests/chrome.ini
editor/libeditor/tests/mochitest.ini
editor/libeditor/tests/test_bug646194.html
editor/libeditor/tests/test_bug646194.xul
--- a/editor/libeditor/tests/chrome.ini
+++ b/editor/libeditor/tests/chrome.ini
@@ -5,17 +5,16 @@ support-files = green.png
 [test_bug489202.xul]
 [test_bug569988.html]
 skip-if = buildapp == 'mulet'
 [test_bug599983.xul]
 skip-if = buildapp == 'mulet'
 [test_bug607584.xul]
 [test_bug616590.xul]
 [test_bug636465.xul]
-[test_bug646194.xul]
 [test_bug780908.xul]
 [test_bug1101392.html]
 subsuite = clipboard
 [test_bug1102906.html]
 [test_bug1140617.xul]
 subsuite = clipboard
 [test_bug1153237.html]
 [test_bug1248128.html]
--- a/editor/libeditor/tests/mochitest.ini
+++ b/editor/libeditor/tests/mochitest.ini
@@ -121,16 +121,17 @@ skip-if = toolkit == 'android' #bug 9577
 [test_bug629845.html]
 [test_bug635636.html]
 skip-if = e10s || os == 'android'
 [test_bug638596.html]
 [test_bug640321.html]
 skip-if = android_version == '18' # bug 1147989
 [test_bug641466.html]
 [test_bug645914.html]
+[test_bug646194.html]
 [test_bug668599.html]
 [test_bug674770-1.html]
 subsuite = clipboard
 skip-if = toolkit == 'android'
 [test_bug674770-2.html]
 subsuite = clipboard
 skip-if = toolkit == 'android'
 [test_bug674861.html]
rename from editor/libeditor/tests/test_bug646194.xul
rename to editor/libeditor/tests/test_bug646194.html
--- a/editor/libeditor/tests/test_bug646194.xul
+++ b/editor/libeditor/tests/test_bug646194.html
@@ -1,63 +1,38 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin"
-                 type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
-                 type="text/css"?>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=646194
--->
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        title="Mozilla Bug 646194" onload="runTest();">
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-
-  <body xmlns="http://www.w3.org/1999/xhtml">
-  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=646194"
-     target="_blank">Mozilla Bug 646194</a>
-  <p/>
-  <iframe id="i" src="data:text/html,&lt;div contenteditable=true id=t&gt;test me now&lt;/div&gt;"/>
-  <p/>
-  <pre id="test">
-  </pre>
-  </body>
-  <script class="testbody" type="application/javascript">
-  <![CDATA[
-
+<!doctype html>
+<title>Mozilla Bug 646194</title>
+<link rel=stylesheet href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=646194"
+   target="_blank">Mozilla Bug 646194</a>
+<iframe id="i" src="data:text/html,&lt;div contenteditable=true id=t&gt;test me now&lt;/div&gt;"></iframe>
+<script>
 SimpleTest.expectAssertions(1);
 
 function runTest() {
-  function doCommand(aCmd) {
-    var controller = top.document.commandDispatcher
-                     .getControllerForCommand(aCmd);
-    ok((controller && controller.isCommandEnabled(aCmd)), "command available");
-    controller.doCommand(aCmd);
-  }
-
   var i = document.getElementById("i");
   i.focus();
   var win = i.contentWindow;
   var doc = i.contentDocument;
   var t = doc.getElementById("t");
   t.focus();
   // put the caret at the end
   win.getSelection().collapse(t.firstChild, 11);
 
   // Simulate pression Option+Delete on Mac
   // We do things this way because not every platform can invoke this
   // command using the available key bindings.
-  doCommand("cmd_wordPrevious");
-  doCommand("cmd_wordPrevious");
-  doCommand("cmd_deleteWordBackward");
-  doCommand("cmd_deleteWordBackward");
+  SpecialPowers.doCommand(window, "cmd_wordPrevious");
+  SpecialPowers.doCommand(window, "cmd_wordPrevious");
+  SpecialPowers.doCommand(window, "cmd_deleteWordBackward");
+  SpecialPowers.doCommand(window, "cmd_deleteWordBackward");
 
   // If we reach here, we haven't crashed.  Phew!
   // But let's check the value too, now that we're here.
   is(t.textContent, "me now", "The command has worked correctly");
 
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
-]]>
+addLoadEvent(runTest);
 </script>
-</window>