Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Test for plugin input event</title> |
michael@0 | 5 | <script type="text/javascript" |
michael@0 | 6 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 7 | <script type="text/javascript" |
michael@0 | 8 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 9 | <script type="text/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/NativeKeyCodes.js"></script> |
michael@0 | 11 | <link rel="stylesheet" type="text/css" |
michael@0 | 12 | href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 13 | </head> |
michael@0 | 14 | <body> |
michael@0 | 15 | <script type="application/javascript"> |
michael@0 | 16 | var pluginHost = SpecialPowers.Cc["@mozilla.org/plugin/host;1"] |
michael@0 | 17 | .getService(SpecialPowers.Ci.nsIPluginHost); |
michael@0 | 18 | var pluginTags = pluginHost.getPluginTags(); |
michael@0 | 19 | for (var tag of pluginTags) { |
michael@0 | 20 | if (tag.name == "Test Plug-in") { |
michael@0 | 21 | tag.enabledState = SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED;; |
michael@0 | 22 | } |
michael@0 | 23 | } |
michael@0 | 24 | </script> |
michael@0 | 25 | |
michael@0 | 26 | <p id="display"> |
michael@0 | 27 | <embed id="plugin" type="application/x-test" wmode="opaque"> |
michael@0 | 28 | </p> |
michael@0 | 29 | <div id="content" style="display: none"> |
michael@0 | 30 | |
michael@0 | 31 | </div> |
michael@0 | 32 | <pre id="test"> |
michael@0 | 33 | </pre> |
michael@0 | 34 | |
michael@0 | 35 | <script type="application/javascript"> |
michael@0 | 36 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 37 | |
michael@0 | 38 | var gPlugin = document.getElementById("plugin"); |
michael@0 | 39 | |
michael@0 | 40 | var gUtils = window. |
michael@0 | 41 | QueryInterface(Components.interfaces.nsIInterfaceRequestor). |
michael@0 | 42 | getInterface(Components.interfaces.nsIDOMWindowUtils); |
michael@0 | 43 | |
michael@0 | 44 | function doTest() { |
michael@0 | 45 | gPlugin.focus(); |
michael@0 | 46 | |
michael@0 | 47 | is(gUtils.IMEStatus, gUtils.IME_STATUS_PLUGIN, |
michael@0 | 48 | "Plugin failed to get focus"); |
michael@0 | 49 | |
michael@0 | 50 | is(gPlugin.getLastKeyText(), "", "Must be empty before first key test"); |
michael@0 | 51 | |
michael@0 | 52 | synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, WIN_VK_A, {}, "a", "a"); |
michael@0 | 53 | is(gPlugin.getLastKeyText(), "a", "Invalid character was inputted"); |
michael@0 | 54 | |
michael@0 | 55 | synthesizeNativeKey(KEYBOARD_LAYOUT_GERMAN, WIN_VK_OEM_PLUS, {}, "+", "+"); |
michael@0 | 56 | is(gPlugin.getLastKeyText(), "+", "Invalid character was inputted"); |
michael@0 | 57 | |
michael@0 | 58 | synthesizeNativeKey(KEYBOARD_LAYOUT_GERMAN, WIN_VK_OEM_PLUS, {altGrKey:1}, "~", "+"); |
michael@0 | 59 | is(gPlugin.getLastKeyText(), "~", "Invalid character was inputted"); |
michael@0 | 60 | |
michael@0 | 61 | SimpleTest.finish(); |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | SimpleTest.waitForFocus(doTest); |
michael@0 | 65 | |
michael@0 | 66 | </script> |
michael@0 | 67 | </body> |
michael@0 | 68 | </html> |