browser/devtools/netmonitor/test/browser_net_accessibility-02.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Tests if keyboard and mouse navigation works in the network requests menu.
     6  */
     8 function test() {
     9   initNetMonitor(CUSTOM_GET_URL).then(([aTab, aDebuggee, aMonitor]) => {
    10     info("Starting test... ");
    12     // It seems that this test may be slow on Ubuntu builds running on ec2.
    13     requestLongerTimeout(2);
    15     let { window, $, NetMonitorView } = aMonitor.panelWin;
    16     let { RequestsMenu } = NetMonitorView;
    18     RequestsMenu.lazyUpdate = false;
    20     waitForNetworkEvents(aMonitor, 2).then(() => {
    21       check(-1, false);
    23       EventUtils.sendKey("DOWN", window);
    24       check(0, true);
    25       EventUtils.sendKey("UP", window);
    26       check(0, true);
    28       EventUtils.sendKey("PAGE_DOWN", window);
    29       check(1, true);
    30       EventUtils.sendKey("PAGE_UP", window);
    31       check(0, true);
    33       EventUtils.sendKey("END", window);
    34       check(1, true);
    35       EventUtils.sendKey("HOME", window);
    36       check(0, true);
    38       aDebuggee.performRequests(18);
    39       return waitForNetworkEvents(aMonitor, 18);
    40     })
    41     .then(() => {
    42       EventUtils.sendKey("DOWN", window);
    43       check(1, true);
    44       EventUtils.sendKey("DOWN", window);
    45       check(2, true);
    46       EventUtils.sendKey("UP", window);
    47       check(1, true);
    48       EventUtils.sendKey("UP", window);
    49       check(0, true);
    51       EventUtils.sendKey("PAGE_DOWN", window);
    52       check(4, true);
    53       EventUtils.sendKey("PAGE_DOWN", window);
    54       check(8, true);
    55       EventUtils.sendKey("PAGE_UP", window);
    56       check(4, true);
    57       EventUtils.sendKey("PAGE_UP", window);
    58       check(0, true);
    60       EventUtils.sendKey("HOME", window);
    61       check(0, true);
    62       EventUtils.sendKey("HOME", window);
    63       check(0, true);
    64       EventUtils.sendKey("PAGE_UP", window);
    65       check(0, true);
    66       EventUtils.sendKey("HOME", window);
    67       check(0, true);
    69       EventUtils.sendKey("END", window);
    70       check(19, true);
    71       EventUtils.sendKey("END", window);
    72       check(19, true);
    73       EventUtils.sendKey("PAGE_DOWN", window);
    74       check(19, true);
    75       EventUtils.sendKey("END", window);
    76       check(19, true);
    78       EventUtils.sendKey("PAGE_UP", window);
    79       check(15, true);
    80       EventUtils.sendKey("PAGE_UP", window);
    81       check(11, true);
    82       EventUtils.sendKey("UP", window);
    83       check(10, true);
    84       EventUtils.sendKey("UP", window);
    85       check(9, true);
    86       EventUtils.sendKey("PAGE_DOWN", window);
    87       check(13, true);
    88       EventUtils.sendKey("PAGE_DOWN", window);
    89       check(17, true);
    90       EventUtils.sendKey("PAGE_DOWN", window);
    91       check(19, true);
    92       EventUtils.sendKey("PAGE_DOWN", window);
    93       check(19, true);
    95       EventUtils.sendKey("HOME", window);
    96       check(0, true);
    97       EventUtils.sendKey("DOWN", window);
    98       check(1, true);
    99       EventUtils.sendKey("END", window);
   100       check(19, true);
   101       EventUtils.sendKey("DOWN", window);
   102       check(19, true);
   104       EventUtils.sendMouseEvent({ type: "mousedown" }, $("#details-pane-toggle"));
   105       check(-1, false);
   107       EventUtils.sendMouseEvent({ type: "mousedown" }, $(".side-menu-widget-item"));
   108       check(0, true);
   110       teardown(aMonitor).then(finish);
   111     });
   113     let count = 0;
   115     function check(aSelectedIndex, aPaneVisibility) {
   116       info("Performing check " + (count++) + ".");
   118       is(RequestsMenu.selectedIndex, aSelectedIndex,
   119         "The selected item in the requests menu was incorrect.");
   120       is(NetMonitorView.detailsPaneHidden, !aPaneVisibility,
   121         "The network requests details pane visibility state was incorrect.");
   122     }
   124     aDebuggee.performRequests(2);
   125   });
   126 }

mercurial