toolkit/content/tests/chrome/test_deck.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 deck
     6   -->
     7 <window title="Deck Test"
     8         onload="setTimeout(test_deck, 0);"
     9         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    10   <script type="application/javascript"
    11           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>      
    12   <script type="application/javascript"
    13           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>      
    15 <deck id="deck1" style="padding-top: 5px; padding-bottom: 12px;">
    16   <button id="d1b1" label="Button One"/>
    17   <button id="d1b2" label="Button Two is larger" height="80" style="margin: 1px;"/>
    18 </deck>
    19 <deck id="deck2" selectedIndex="1">
    20   <button id="d2b1" label="Button One"/>
    21   <button id="d2b2" label="Button Two"/>
    22 </deck>
    24   <!-- test results are displayed in the html:body -->
    25   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
    27   <!-- test code goes here -->
    28   <script type="application/javascript"><![CDATA[
    30 SimpleTest.waitForExplicitFinish();
    32 function test_deck()
    33 {
    34   var deck = $("deck1");
    35   ok(deck.selectedIndex === '0', "deck one selectedIndex");
    36   // this size is the button height, 80, plus the button padding of 1px on each side,
    37   // plus the deck's 5px top padding and the 12px bottom padding.
    38   var rect = deck.getBoundingClientRect();
    39   is(Math.round(rect.bottom) - Math.round(rect.top), 99, "deck size of largest child");
    40   synthesizeMouseExpectEvent(deck, 12, 12, { }, $("d1b1"), "click", "mouse on deck one");
    42   // change the selected page of the deck and ensure that the mouse click goes
    43   // to the button on that page
    44   deck.selectedIndex = 1;
    45   ok(deck.selectedIndex === '1', "deck one selectedIndex after change");
    46   synthesizeMouseExpectEvent(deck, 9, 9, { }, $("d1b2"), "click", "mouse on deck one after change");
    48   deck = $("deck2");
    49   ok(deck.selectedIndex === '1', "deck two selectedIndex");
    50   synthesizeMouseExpectEvent(deck, 9, 9, { }, $("d2b2"), "click", "mouse on deck two");
    52   SimpleTest.finish();
    53 }
    55 ]]>
    56 </script>
    58 </window>

mercurial