Bug 1271119 - Port test_bug646194.xul from chrome to mochitest; r?masayuki
MozReview-Commit-ID: Lx05BEKQiwO
--- a/editor/libeditor/tests/chrome.ini
+++ b/editor/libeditor/tests/chrome.ini
@@ -11,17 +11,16 @@ support-files = spellcheck.js
[test_bug569988.html]
skip-if = buildapp == 'mulet'
[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]
subsuite = clipboard
--- a/editor/libeditor/tests/mochitest.ini
+++ b/editor/libeditor/tests/mochitest.ini
@@ -114,16 +114,17 @@ skip-if = toolkit == 'android' #TIMED_OU
skip-if = toolkit == 'android' #bug 957797
[test_bug625452.html]
[test_bug629845.html]
[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,<div contenteditable=true id=t>test me now</div>"/>
- <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,<div contenteditable=true id=t>test me now</div>"></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>