2011-04-21 03:54:43 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Test for plugin input event</title>
|
2019-04-16 06:59:25 +03:00
|
|
|
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
|
|
|
<script src="chrome://mochikit/content/tests/SimpleTest/NativeKeyCodes.js"></script>
|
2014-02-17 18:58:06 +04:00
|
|
|
<script type="text/javascript" src="utils.js"></script>
|
2011-04-21 03:54:43 +04:00
|
|
|
<link rel="stylesheet" type="text/css"
|
|
|
|
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
2013-09-04 18:07:53 +04:00
|
|
|
<script type="application/javascript">
|
2014-02-17 18:58:06 +04:00
|
|
|
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
|
2013-09-04 18:07:53 +04:00
|
|
|
</script>
|
|
|
|
|
2011-04-21 03:54:43 +04:00
|
|
|
<p id="display">
|
|
|
|
<embed id="plugin" type="application/x-test" wmode="opaque">
|
|
|
|
</p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
var gPlugin = document.getElementById("plugin");
|
|
|
|
|
2018-07-25 02:47:43 +03:00
|
|
|
var gUtils = window.windowUtils;
|
2011-04-21 03:54:43 +04:00
|
|
|
|
2015-04-14 18:36:36 +03:00
|
|
|
function* doTest() {
|
2011-04-21 03:54:43 +04:00
|
|
|
gPlugin.focus();
|
|
|
|
|
|
|
|
is(gUtils.IMEStatus, gUtils.IME_STATUS_PLUGIN,
|
|
|
|
"Plugin failed to get focus");
|
|
|
|
|
|
|
|
is(gPlugin.getLastKeyText(), "", "Must be empty before first key test");
|
|
|
|
|
2015-04-14 18:36:36 +03:00
|
|
|
yield synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, WIN_VK_A, {}, "a", "a", continueTest);
|
2011-04-21 03:54:43 +04:00
|
|
|
is(gPlugin.getLastKeyText(), "a", "Invalid character was inputted");
|
|
|
|
|
2015-04-14 18:36:36 +03:00
|
|
|
yield synthesizeNativeKey(KEYBOARD_LAYOUT_GERMAN, WIN_VK_OEM_PLUS, {}, "+", "+", continueTest);
|
2011-04-21 03:54:43 +04:00
|
|
|
is(gPlugin.getLastKeyText(), "+", "Invalid character was inputted");
|
|
|
|
|
2019-02-14 23:20:20 +03:00
|
|
|
yield synthesizeNativeKey(KEYBOARD_LAYOUT_GERMAN, WIN_VK_OEM_PLUS, {altGrKey: 1}, "~", "+", continueTest);
|
2011-04-21 03:54:43 +04:00
|
|
|
is(gPlugin.getLastKeyText(), "~", "Invalid character was inputted");
|
2015-04-14 18:36:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
var gTestContinuation = null;
|
2011-04-21 03:54:43 +04:00
|
|
|
|
2015-04-14 18:36:36 +03:00
|
|
|
function continueTest() {
|
|
|
|
if (!gTestContinuation) {
|
|
|
|
gTestContinuation = doTest(continueTest);
|
|
|
|
}
|
|
|
|
var ret = gTestContinuation.next();
|
|
|
|
if (ret.done) {
|
|
|
|
SimpleTest.finish();
|
|
|
|
} else {
|
|
|
|
is(ret.value, true, "Key synthesized successfully");
|
|
|
|
}
|
2011-04-21 03:54:43 +04:00
|
|
|
}
|
|
|
|
|
2015-04-14 18:36:36 +03:00
|
|
|
SimpleTest.waitForFocus(continueTest);
|
2011-04-21 03:54:43 +04:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|