mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-30 13:45:27 +00:00
69 lines
2.0 KiB
HTML
69 lines
2.0 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test for plugin input event</title>
|
|
<script type="text/javascript"
|
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="text/javascript"
|
|
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
|
<script type="text/javascript"
|
|
src="chrome://mochikit/content/tests/SimpleTest/NativeKeyCodes.js"></script>
|
|
<link rel="stylesheet" type="text/css"
|
|
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
|
</head>
|
|
<body>
|
|
<script type="application/javascript">
|
|
var pluginHost = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
|
|
.getService(SpecialPowers.Ci.nsIPluginHost);
|
|
var pluginTags = pluginHost.getPluginTags();
|
|
for (var tag of pluginTags) {
|
|
if (tag.name == "Test Plug-in") {
|
|
tag.enabledState = SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED;;
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<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");
|
|
|
|
var gUtils = window.
|
|
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
|
getInterface(Components.interfaces.nsIDOMWindowUtils);
|
|
|
|
function doTest() {
|
|
gPlugin.focus();
|
|
|
|
is(gUtils.IMEStatus, gUtils.IME_STATUS_PLUGIN,
|
|
"Plugin failed to get focus");
|
|
|
|
is(gPlugin.getLastKeyText(), "", "Must be empty before first key test");
|
|
|
|
synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, WIN_VK_A, {}, "a", "a");
|
|
is(gPlugin.getLastKeyText(), "a", "Invalid character was inputted");
|
|
|
|
synthesizeNativeKey(KEYBOARD_LAYOUT_GERMAN, WIN_VK_OEM_PLUS, {}, "+", "+");
|
|
is(gPlugin.getLastKeyText(), "+", "Invalid character was inputted");
|
|
|
|
synthesizeNativeKey(KEYBOARD_LAYOUT_GERMAN, WIN_VK_OEM_PLUS, {altGrKey:1}, "~", "+");
|
|
is(gPlugin.getLastKeyText(), "~", "Invalid character was inputted");
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
SimpleTest.waitForFocus(doTest);
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|