Bug 1675349: Update tests under widget/tests for the removal of plugins. r=jmathies
authorDavid Parks <daparks@mozilla.com>
Wed, 18 Nov 2020 16:01:27 +0000
changeset 557845 6f79bd1536596ad0fff306190792654177d4c3bd
parent 557844 787cb1497e8641e9879d57d9ff75ce22a6e6e585
child 557846 df4bbb92b9728e9c5a4f803f1c6a2b13a922328c
push id37962
push userapavel@mozilla.com
push dateWed, 18 Nov 2020 21:51:58 +0000
treeherdermozilla-central@9d797387f57c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmathies
bugs1675349
milestone85.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1675349: Update tests under widget/tests for the removal of plugins. r=jmathies UPDATED ------- widget/tests/test_imestate.html Test that plugin IME state properly tracks focus Update to reflect that plugins are not IME focusable. REMOVED ------- widget/tests/test_plugin_scroll_consistency.html On most platforms does nothing but on Windows performs basic test that layout positions and sizes are internally consistent. widget/tests/test_chrome_context_menus_win.xhtml Make sure that right-clickable chrome context menus appear when a plugin has focus. widget/tests/test_plugin_input_event.html Test plugin keyboard input Differential Revision: https://phabricator.services.mozilla.com/D95920
widget/tests/chrome.ini
widget/tests/chrome_context_menus_win.xhtml
widget/tests/test_chrome_context_menus_win.xhtml
widget/tests/test_imestate.html
widget/tests/test_plugin_input_event.html
--- a/widget/tests/chrome.ini
+++ b/widget/tests/chrome.ini
@@ -23,17 +23,16 @@ support-files = window_bug538242.xhtml
 skip-if = toolkit != "windows"
 [test_bug593307.xhtml]
 support-files = window_bug593307_offscreen.xhtml window_bug593307_centerscreen.xhtml
 [test_keycodes.xhtml]
 [test_wheeltransaction.xhtml]
 support-files = window_wheeltransaction.xhtml
 [test_imestate.html]
 support-files = window_imestate_iframes.html
-[test_plugin_scroll_consistency.html]
 [test_composition_text_querycontent.xhtml]
 support-files = window_composition_text_querycontent.xhtml
 [test_input_events_on_deactive_window.xhtml]
 support-files = file_input_events_on_deactive_window.html
 [test_position_on_resize.xhtml]
 skip-if = 
    verify && (os == 'win')
    webrender && (os == "linux" && bits == 64) # Bug 1616760
@@ -90,21 +89,16 @@ skip-if = toolkit != "cocoa"
 
 [test_system_font_changes.xhtml]
 support-files = system_font_changes.xhtml
 run-if = toolkit == 'gtk' # Currently the test works on only gtk3
 
 # Windows
 # taskbar_previews.xhtml
 # window_state_windows.xhtml
-[test_chrome_context_menus_win.xhtml]
-skip-if = toolkit != "windows"
-support-files = chrome_context_menus_win.xhtml
-[test_plugin_input_event.html]
-skip-if = toolkit != "windows"
 [test_mouse_scroll.xhtml]
 skip-if = toolkit != "windows"
 support-files =
   window_mouse_scroll_win.html
   window_mouse_scroll_win_2.html
 
 # Privacy relevant
 [test_bug1123480.xhtml]
deleted file mode 100644
--- a/widget/tests/chrome_context_menus_win.xhtml
+++ /dev/null
@@ -1,98 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-
-<window id="ChromeContextMenuTest"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        width="300"
-        height="300"
-        title="Chrome Context Menu Test w/Plugin Focus">
-
-<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
-<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
-
-<popupset>
-  <menupopup id="testmenu" onpopupshown="menuDisplayed()">
-    <menuitem label="One"/>
-    <menuitem label="Two"/>
-    <menuitem label="Three"/>
-  </menupopup>
-</popupset>
-
-<toolbox>
-  <toolbar id="nav-toolbar" style="height:30px" context="testmenu">
-  </toolbar>
-</toolbox>
-
-<script type="application/javascript"><![CDATA[
-
-function ok(condition, message) {
-    window.arguments[0].SimpleTest.ok(condition, message);
-}
-
-function onTestsFinished() {
-    window.close();
-    window.arguments[0].SimpleTest.finish();
-}
-
-function openContextMenuFor(element) {
-
-    var utils = window.windowUtils;
-
-    var tbX = (window.mozInnerScreenX + 10) * utils.screenPixelsPerCSSPixel;
-    var tbY = (window.mozInnerScreenY + 10) * utils.screenPixelsPerCSSPixel;
-
-    // See nsWidnow's SynthesizeNativeMouseEvent & SendInput on msdn
-    var MOUSEEVENTF_RIGHTDOWN = 0x0008;
-    var MOUSEEVENTF_RIGHTUP = 0x0010;
-
-    utils.sendNativeMouseEvent(tbX, tbY,
-                               MOUSEEVENTF_RIGHTDOWN,
-                               0, element);
-    utils.sendNativeMouseEvent(tbX, tbY,
-                               MOUSEEVENTF_RIGHTUP,
-                               0, element);
-}
-
-var tid = 0;
-
-function onFocus() {
-    var _delayedOnLoad = function() {
-        var plugin = document.getElementById("plugin");
-        var toolbar = document.getElementById("nav-toolbar");
-
-        plugin.focus();
-
-        tid = setTimeout(menuTimeout, 5000);
-
-        openContextMenuFor(toolbar);
-    }
-    setTimeout(_delayedOnLoad, 3000);
-}
-
-function menuTimeout() {
-    ok(false, "Right-click chrome menu did not display with focus on a plugin.");
-    onTestsFinished();
-}
-
-function menuDisplayed() {
-    clearTimeout(tid);
-    ok(true, "Right-click chrome menu displayed despite plugin having focus.");
-    onTestsFinished();
-}
-
-window.arguments[0].SimpleTest.waitForFocus(onFocus, window);
-
-
-]]></script>
-
-<body xmlns="http://www.w3.org/1999/xhtml">
-  <br/>
-  <embed id="plugin" type="application/x-test" width="50" height="50"></embed>
-</body>
-
-</window>
deleted file mode 100644
--- a/widget/tests/test_chrome_context_menus_win.xhtml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
-<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
-<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
-<script type="application/javascript" src="utils.js"></script>
-<script>
-    setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
-    SimpleTest.waitForExplicitFinish();
-
-    var w = window.browsingContext.topChromeWindow.openDialog(
-        'chrome_context_menus_win.xhtml', '_blank', 'chrome,resizable=yes,width=600,height=600', window);
-
-    function done()
-    {
-        w.close();
-        SimpleTest.finish();
-    }
-</script>
-<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;" />
-</window>
--- a/widget/tests/test_imestate.html
+++ b/widget/tests/test_imestate.html
@@ -3,19 +3,16 @@
   <title>Test for IME state controling</title>
   <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
   <script type="text/javascript" src="utils.js"></script>
   <link rel="stylesheet" type="text/css"
           href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 </head>
 <body onload="setTimeout(runTests, 0);" style="ime-mode: disabled;">
-<script>
-setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
-</script>
 <div id="display" style="ime-mode: disabled;">
   <!-- input elements -->
   <input type="text"     id="text"/><br/>
   <input type="text"     id="text_readonly" readonly="readonly"/><br/>
   <input type="password" id="password"/><br/>
   <input type="password" id="password_readonly" readonly="readonly"/><br/>
   <input type="checkbox" id="checkbox"/><br/>
   <input type="radio"    id="radio"/><br/>
@@ -669,31 +666,34 @@ function runPluginTest() {
   if (navigator.platform.indexOf("Mac") == 0) {
     // XXX on mac, currently, this test isn't passed because it doesn't return
     // IME_STATUS_PLUGIN by its bug.
     return;
   }
 
   var plugin = document.getElementById("plugin");
 
+  // Plugins are not supported and their elements should not accept focus;
+  // therefore, IME should not enable when we play with it.
+
   document.activeElement.blur();
   is(gUtils.IMEStatus, gUtils.IME_STATUS_DISABLED,
      "runPluginTest: unexpected enabled state when no element has focus");
 
   plugin.focus();
-  is(gUtils.IMEStatus, gUtils.IME_STATUS_PLUGIN,
-     "runPluginTest: unexpected enabled state when plugin has focus");
+  is(gUtils.IMEStatus, gUtils.IME_STATUS_DISABLED,
+     "runPluginTest: unexpected enabled state when attempting to give focus to plugin");
 
   plugin.blur();
   is(gUtils.IMEStatus, gUtils.IME_STATUS_DISABLED,
-     "runPluginTest: unexpected enabled state when plugin has focus");
+     "runPluginTest: unexpected enabled state after unfocusing plugin");
 
   plugin.focus();
-  is(gUtils.IMEStatus, gUtils.IME_STATUS_PLUGIN,
-     "runPluginTest: unexpected enabled state when plugin has focus #2");
+  is(gUtils.IMEStatus, gUtils.IME_STATUS_DISABLED,
+     "runPluginTest: unexpected enabled state when attempting to give focus to plugin #2");
 
   var parent = plugin.parentNode;
   parent.removeChild(plugin);
   is(gUtils.IMEStatus, gUtils.IME_STATUS_DISABLED,
      "runPluginTest: unexpected enabled state when plugin is removed from tree");
 
   document.getElementById("text").focus();
   is(gUtils.IMEStatus, gUtils.IME_STATUS_ENABLED,
deleted file mode 100644
--- a/widget/tests/test_plugin_input_event.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test for plugin input event</title>
-  <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>
-  <script type="text/javascript" src="utils.js"></script>
-  <link rel="stylesheet" type="text/css"
-          href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-<script type="application/javascript">
-setTestPluginEnabledState(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.windowUtils;
-
-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");
-
-  yield synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, WIN_VK_A, {}, "a", "a", continueTest);
-  is(gPlugin.getLastKeyText(), "a", "Invalid character was inputted");
-
-  yield synthesizeNativeKey(KEYBOARD_LAYOUT_GERMAN, WIN_VK_OEM_PLUS, {}, "+", "+", continueTest);
-  is(gPlugin.getLastKeyText(), "+", "Invalid character was inputted");
-
-  yield synthesizeNativeKey(KEYBOARD_LAYOUT_GERMAN, WIN_VK_OEM_PLUS, {altGrKey: 1}, "~", "+", continueTest);
-  is(gPlugin.getLastKeyText(), "~", "Invalid character was inputted");
-}
-
-var gTestContinuation = null;
-
-function continueTest() {
-  if (!gTestContinuation) {
-    gTestContinuation = doTest(continueTest);
-  }
-  var ret = gTestContinuation.next();
-  if (ret.done) {
-    SimpleTest.finish();
-  } else {
-    is(ret.value, true, "Key synthesized successfully");
-  }
-}
-
-SimpleTest.waitForFocus(continueTest);
-
-</script>
-</body>
-</html>