Bug 1271120 - Port test_bug636465.xul from chrome to plain; r?masayuki draft
authorAryeh Gregor <ayg@aryeh.name>
Thu, 01 Sep 2016 17:30:57 +0300
changeset 430250 52e430ee04cbc377ccc543b5924add67dbed3b07
parent 430249 93c2b1945574a430a87fc343124e66cf48f2d861
child 430251 22f610e98d27492446b710feafe44fc24bdb9172
push id33786
push userayg@aryeh.name
push dateThu, 27 Oct 2016 12:00:23 +0000
reviewersmasayuki
bugs1271120, 636465
milestone52.0a1
Bug 1271120 - Port test_bug636465.xul from chrome to plain; r?masayuki MozReview-Commit-ID: B0oaEGGEEvd
editor/libeditor/tests/chrome.ini
editor/libeditor/tests/mochitest.ini
editor/libeditor/tests/test_bug636465.html
editor/libeditor/tests/test_bug636465.xul
--- a/editor/libeditor/tests/chrome.ini
+++ b/editor/libeditor/tests/chrome.ini
@@ -10,17 +10,16 @@ support-files = spellcheck.js
 [test_bug489202.xul]
 [test_bug490879.xul]
 subsuite = clipboard
 [test_bug599983.xul]
 skip-if = buildapp == 'mulet'
 [test_bug607584.xul]
 [test_bug616590.xul]
 [test_bug635636.html]
-[test_bug636465.xul]
 [test_bug646194.xul]
 [test_bug780908.xul]
 [test_bug830600.html]
 subsuite = clipboard
 [test_bug1053048.html]
 [test_bug1100966.html]
 [test_bug1102906.html]
 [test_bug1101392.html]
--- a/editor/libeditor/tests/mochitest.ini
+++ b/editor/libeditor/tests/mochitest.ini
@@ -108,16 +108,17 @@ skip-if = toolkit == 'android'
 [test_bug612128.html]
 [test_bug612447.html]
 [test_bug620906.html]
 skip-if = toolkit == 'android' #TIMED_OUT
 [test_bug622371.html]
 skip-if = toolkit == 'android' #bug 957797
 [test_bug625452.html]
 [test_bug629845.html]
+[test_bug636465.html]
 [test_bug638596.html]
 [test_bug640321.html]
 skip-if = android_version == '18' # bug 1147989
 [test_bug641466.html]
 [test_bug645914.html]
 [test_bug668599.html]
 [test_bug674770-1.html]
 subsuite = clipboard
rename from editor/libeditor/tests/test_bug636465.xul
rename to editor/libeditor/tests/test_bug636465.html
--- a/editor/libeditor/tests/test_bug636465.xul
+++ b/editor/libeditor/tests/test_bug636465.html
@@ -1,61 +1,42 @@
-<?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=636465
--->
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        title="Mozilla Bug 636465" onload="runTest();">
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"/>
+<!doctype html>
+<title>Mozilla bug 636465</title>
+<link rel=stylesheet href="/tests/SimpleTest/test.css">
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="/tests/SimpleTest/WindowSnapshot.js"></script>
+<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=636465"
+   target="_blank">Mozilla Bug 636465</a>
+<input id="x" value="foobarbaz" spellcheck="true">
+<script>
+SimpleTest.waitForExplicitFinish();
 
-  <body xmlns="http://www.w3.org/1999/xhtml">
-  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=636465"
-     target="_blank">Mozilla Bug 636465</a>
-  <p/>
-  <p/>
-  <pre id="test">
-  </pre>
-  </body>
-  <textbox id="x" value="foobarbaz" spellcheck="true"/>
-  <script class="testbody" type="application/javascript">
-  <![CDATA[
-
-  SimpleTest.waitForExplicitFinish();
-
-  function runTest() {
-    Components.utils.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm");
-    var x = document.getElementById("x");
+function runTest() {
+  SpecialPowers.Cu.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm",
+                          window);
+  var x = document.getElementById("x");
+  x.focus();
+  onSpellCheck(x, function () {
+    x.blur();
+    var spellCheckTrue = snapshotWindow(window);
+    x.setAttribute("spellcheck", "false");
+    var spellCheckFalse = snapshotWindow(window);
+    x.setAttribute("spellcheck", "true");
     x.focus();
     onSpellCheck(x, function () {
       x.blur();
-      var spellCheckTrue = snapshotWindow(window);
-      x.setAttribute("spellcheck", "false");
-      var spellCheckFalse = snapshotWindow(window);
-      x.setAttribute("spellcheck", "true");
-      x.focus();
-      onSpellCheck(x, function () {
-        x.blur();
-        var spellCheckTrueAgain = snapshotWindow(window);
-        x.removeAttribute("spellcheck");
-        var spellCheckNone = snapshotWindow(window);
-        var after = snapshotWindow(window);
-        ok(compareSnapshots(spellCheckTrue, spellCheckFalse, false)[0],
-           "Setting the spellcheck attribute to false should work");
-        ok(compareSnapshots(spellCheckTrue, spellCheckTrueAgain, true)[0],
-           "Setting the spellcheck attribute back to true should work");
-        ok(compareSnapshots(spellCheckNone, spellCheckFalse, true)[0],
-           "Unsetting the spellcheck attribute should work");
-        SimpleTest.finish();
-      });
+      var spellCheckTrueAgain = snapshotWindow(window);
+      x.removeAttribute("spellcheck");
+      var spellCheckNone = snapshotWindow(window);
+      var after = snapshotWindow(window);
+      ok(compareSnapshots(spellCheckTrue, spellCheckFalse, false)[0],
+         "Setting the spellcheck attribute to false should work");
+      ok(compareSnapshots(spellCheckTrue, spellCheckTrueAgain, true)[0],
+         "Setting the spellcheck attribute back to true should work");
+      ok(compareSnapshots(spellCheckNone, spellCheckFalse, true)[0],
+         "Unsetting the spellcheck attribute should work");
+      SimpleTest.finish();
     });
-  }
-]]>
+  });
+}
+addLoadEvent(runTest);
 </script>
-</window>