summaryrefslogtreecommitdiffstats
path: root/toolkit/content/tests/chrome/test_menuitem_blink.xul
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-25 15:07:00 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:55:19 +0200
commiteb70e6e3d0bff11c25f14b1196025791bf2308fb (patch)
tree5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/content/tests/chrome/test_menuitem_blink.xul
parent32ead795290b3399d56b4708fc75b77d296f6a1a (diff)
downloadUXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz
UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/content/tests/chrome/test_menuitem_blink.xul')
-rw-r--r--toolkit/content/tests/chrome/test_menuitem_blink.xul106
1 files changed, 0 insertions, 106 deletions
diff --git a/toolkit/content/tests/chrome/test_menuitem_blink.xul b/toolkit/content/tests/chrome/test_menuitem_blink.xul
deleted file mode 100644
index 319c284fd..000000000
--- a/toolkit/content/tests/chrome/test_menuitem_blink.xul
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
-
-<window title="Blinking Context Menu Item Tests"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
-
- <menulist id="menulist">
- <menupopup id="menupopup">
- <menuitem label="Menu Item" id="menuitem"/>
- </menupopup>
- </menulist>
-<script class="testbody" type="application/javascript">
-<![CDATA[
-
-SimpleTest.waitForExplicitFinish();
-SimpleTest.waitForFocus(startTest);
-
-function startTest() {
- if (!/Mac/.test(navigator.platform)) {
- ok(true, "Nothing to test on non-Mac.");
- SimpleTest.finish();
- return;
- }
- // Destroy frame while removing the _moz-menuactive attribute.
- test_crash("REMOVAL", test2);
-}
-
-function test2() {
- // Destroy frame while adding the _moz-menuactive attribute.
- test_crash("ADDITION", test3);
-}
-
-function test3() {
- // Don't mess with the frame, just test whether we've blinked.
- test_crash("", SimpleTest.finish);
-}
-
-function test_crash(when, andThen) {
- var menupopup = document.getElementById("menupopup");
- var menuitem = document.getElementById("menuitem");
- var attrChanges = { "REMOVAL": 0, "ADDITION": 0 };
- var storedEvent = null;
- menupopup.addEventListener("popupshown", function () {
- menupopup.removeEventListener("popupshown", arguments.callee, false);
- menuitem.addEventListener("mouseup", function (e) {
- menuitem.removeEventListener("mouseup", arguments.callee, true);
- menuitem.addEventListener("DOMAttrModified", function (e) {
- if (e.attrName == "_moz-menuactive") {
- if (!attrChanges[e.attrChange])
- attrChanges[e.attrChange] = 1;
- else
- attrChanges[e.attrChange]++;
- storedEvent = e;
- if (e.attrChange == e[when]) {
- menuitem.hidden = true;
- menuitem.getBoundingClientRect();
- ok(true, "Didn't crash on _moz-menuactive " + when.toLowerCase() + " during blinking")
- menuitem.hidden = false;
- menuitem.removeEventListener("DOMAttrModified", arguments.callee, false);
- SimpleTest.executeSoon(function () {
- menupopup.hidePopup();
- });
- }
- }
- }, false);
- }, true);
- menupopup.addEventListener("popuphidden", function() {
- menupopup.removeEventListener("popuphidden", arguments.callee, false);
- if (!when) {
- // Test whether we've blinked at all.
- var shouldBlink = navigator.platform.match(/Mac/);
- var expectedNumRemoval = shouldBlink ? 2 : 1;
- var expectedNumAddition = shouldBlink ? 1 : 0;
- ok(storedEvent, "got DOMAttrModified events after clicking menuitem")
- is(attrChanges[storedEvent.REMOVAL], expectedNumRemoval, "blinking unset attributes correctly");
- is(attrChanges[storedEvent.ADDITION], expectedNumAddition, "blinking set attributes correctly");
- }
- SimpleTest.executeSoon(andThen);
- }, false);
- synthesizeMouse(menuitem, 10, 5, { type : "mousemove" });
- synthesizeMouse(menuitem, 10, 5, { type : "mousemove" });
- synthesizeMouse(menuitem, 10, 5, { type : "mousedown" });
- SimpleTest.executeSoon(function () {
- synthesizeMouse(menuitem, 10, 5, { type : "mouseup" });
- });
- }, false);
- document.getElementById("menulist").open = true;
-}
-
-]]>
-</script>
-
-<body xmlns="http://www.w3.org/1999/xhtml">
-<p id="display">
-</p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-</pre>
-</body>
-
-</window>