accessible/tests/mochitest/actions/test_keys_menu.xul

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
     4                  type="text/css"?>
     6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     7         title="Accessible XUL access keys and shortcut keys tests">
     9   <script type="application/javascript"
    10           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
    12   <script type="application/javascript"
    13           src="../common.js" />
    14   <script type="application/javascript"
    15           src="../events.js" />
    17   <script type="application/javascript">
    18   <![CDATA[
    19     function openMenu(aMenuID, aMenuitemID)
    20     {
    21       this.menuNode = getNode(aMenuID),
    22       this.menuitemNode = getNode(aMenuitemID),
    24       this.eventSeq = [
    25         new invokerChecker(EVENT_FOCUS, this.menuNode)
    26       ];
    28       this.invoke = function openMenu_invoke()
    29       {
    30         // Show menu.
    31         this.menuNode.open = true;
    32       }
    34       this.finalCheck = function openMenu_finalCheck()
    35       {
    36         var menu = getAccessible(aMenuID);
    37         is(menu.accessKey, (MAC ? "u" : "Alt+u"),
    38            "Wrong accesskey on " + prettyName(this.menuitemNode));
    40         var menuitem = getAccessible(aMenuitemID);
    41         is(menuitem.accessKey, "p",
    42            "Wrong accesskey on " + prettyName(this.menuitemNode));
    43         is(menuitem.keyboardShortcut, (MAC ? "⌃l" : "Ctrl+l"),
    44            "Wrong keyboard shortcut on " + prettyName(this.menuitemNode));
    45       }
    47       this.getID = function openMenu_getID()
    48       {
    49         return "menuitem accesskey and shortcut test " +
    50           prettyName(this.menuItemNode);
    51       }
    52     }
    54     var gQueue = null;
    55     function doTest()
    56     {
    57       gQueue = new eventQueue();
    58       gQueue.push(new openMenu("menu", "menuitem"));
    59       gQueue.invoke(); // Will call SimpleTest.finish();
    60     }
    62     SimpleTest.waitForExplicitFinish();
    63     addA11yLoadEvent(doTest);
    64   ]]>
    65   </script>
    67   <hbox flex="1" style="overflow: auto;">
    68     <body xmlns="http://www.w3.org/1999/xhtml">
    69       <a target="_blank"
    70          href="https://bugzilla.mozilla.org/show_bug.cgi?id=672092"
    71          title="Reorganize access key and keyboard shortcut handling code">
    72         Mozilla Bug 672092
    73       </a><br/>
    74       <p id="display"></p>
    75       <div id="content" style="display: none">
    76       </div>
    77       <pre id="test">
    78       </pre>
    79     </body>
    81     <vbox flex="1">
    82       <keyset>
    83         <key key="l" modifiers="control" id="key1"/>
    84       </keyset>
    86       <menubar>
    87         <menu label="menu" id="menu" accesskey="u">
    88           <menupopup>
    89             <menuitem accesskey="p" key="key1" label="item1" id="menuitem"/>
    90           </menupopup>
    91         </menu>
    92       </menubar>
    94       <vbox id="debug"/>
    95     </vbox>
    96   </hbox>
    98 </window>

mercurial