Bug 1271119 - Port test_bug1248128.html from chrome to plain; r=masayuki

I added an extra check to ensure that the test wasn't passing because
doCommand() was throwing some unrelated exception, in case porting from
chrome to plain changed behavior of doCommand().

MozReview-Commit-ID: LOo8yN8jkZo
This commit is contained in:
Aryeh Gregor 2016-10-31 18:26:31 +02:00
Родитель 2459cda825
Коммит d63d3c394b
3 изменённых файлов: 14 добавлений и 14 удалений

Просмотреть файл

@ -12,7 +12,6 @@ skip-if = buildapp == 'mulet'
[test_bug636465.xul]
[test_bug780908.xul]
[test_bug1102906.html]
[test_bug1248128.html]
[test_bug1248185.html]
[test_composition_event_created_in_chrome.html]
[test_contenteditable_text_input_handling.html]

Просмотреть файл

@ -197,6 +197,7 @@ skip-if = os == 'android'
[test_bug1247483.html]
subsuite = clipboard
skip-if = toolkit == 'android'
[test_bug1248128.html]
[test_bug1250010.html]
[test_bug1257363.html]
[test_bug1258085.html]

Просмотреть файл

@ -6,8 +6,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1248128
<head>
<meta charset="utf-8">
<title>Test for Bug 1248128</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 src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
@ -22,23 +23,22 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1248128
var scroll = outer.scrollTop;
ok(scroll > 0, "element has scrolled: new value " + scroll);
const kMoveLeft = "cmd_moveLeft";
var controller =
top.document.commandDispatcher.getControllerForCommand(kMoveLeft);
ok((controller && controller.isCommandEnabled(kMoveLeft)),
"have " + kMoveLeft + " command");
try {
controller.doCommand(kMoveLeft);
ok(false, "should not be able to do kMoveLeft");
SpecialPowers.doCommand(window, "cmd_moveLeft");
ok(false, "should not be able to do kMoveLeft");
} catch (e) {
ok(true, "unable to perform kMoveLeft");
}
catch (e) {
ok(true, "unable to perform kMoveLeft");
}
ok(outer.scrollTop == scroll,
"scroll is unchanged: got " + outer.scrollTop + ", expected " + scroll);
// Make sure cmd_moveLeft isn't failing for some unrelated reason
synthesizeKey("a", {});
is(input.selectionStart, 1, "selectionStart after typing");
SpecialPowers.doCommand(window, "cmd_moveLeft");
is(input.selectionStart, 0, "selectionStart after move left");
SimpleTest.finish();
});
</script>