toolkit/content/tests/chrome/test_button.xul

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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" type="text/css"?>
     4 <!--
     5   XUL Widget Test for button
     6   -->
     7 <window title="Button Test"
     8         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     9   <script type="application/javascript"
    10           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>      
    11   <script type="application/javascript"
    12           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>      
    14 <button id="one" label="One" />
    15 <button id="two" label="Two"/>
    16 <hbox>
    17   <button id="three" label="Three" open="true"/>
    18 </hbox>
    19 <hbox>
    20   <button id="four" type="menu" label="Four"/>
    21   <button id="five" type="panel" label="Five"/>
    22   <button id="six" label="Six"/>
    23 </hbox>
    25   <!-- test results are displayed in the html:body -->
    26   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
    28 <script type="application/javascript">
    29 <![CDATA[
    31 SimpleTest.waitForExplicitFinish();
    33 function test_button()
    34 {
    35   synthesizeMouseExpectEvent($("one"), 2, 2, {}, $("one"), "command", "button press");
    36   $("one").focus();
    37   synthesizeKeyExpectEvent("VK_SPACE", { }, $("one"), "command", "key press");
    38   $("two").disabled = true;
    39   synthesizeMouseExpectEvent($("two"), 2, 2, {}, $("two"), "!command", "button press command when disabled");
    40   synthesizeMouseExpectEvent($("two"), 2, 2, {}, $("two"), "click", "button press click when disabled");
    42   if (navigator.platform.indexOf("Mac") == -1) {
    43     $("one").focus();
    44     synthesizeKey("VK_DOWN", { });
    45     is(document.activeElement, $("three"), "key cursor down on button");
    47     synthesizeKey("VK_RIGHT", { });
    48     is(document.activeElement, $("four"), "key cursor right on button");
    49     synthesizeKey("VK_DOWN", { });
    50     is(document.activeElement, $("four"), "key cursor down on menu button");
    51     $("five").focus();
    52     synthesizeKey("VK_DOWN", { });
    53     is(document.activeElement, $("five"), "key cursor down on panel button");
    55     $("three").focus();
    56     synthesizeKey("VK_UP", { });
    57     is(document.activeElement, $("one"), "key cursor up on button");
    58   }
    60   $("two").focus();
    61   ok(document.activeElement != $("two"), "focus disabled button");
    63   SimpleTest.finish();
    64 }
    66 SimpleTest.waitForFocus(test_button);
    68 ]]>
    69 </script>
    71 </window>

mercurial