Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * Tests if focus modifiers work for the SideMenuWidget. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | function test() { |
michael@0 | 9 | initNetMonitor(CUSTOM_GET_URL).then(([aTab, aDebuggee, aMonitor]) => { |
michael@0 | 10 | info("Starting test... "); |
michael@0 | 11 | |
michael@0 | 12 | // It seems that this test may be slow on Ubuntu builds running on ec2. |
michael@0 | 13 | requestLongerTimeout(2); |
michael@0 | 14 | |
michael@0 | 15 | let { NetMonitorView } = aMonitor.panelWin; |
michael@0 | 16 | let { RequestsMenu } = NetMonitorView; |
michael@0 | 17 | |
michael@0 | 18 | RequestsMenu.lazyUpdate = false; |
michael@0 | 19 | |
michael@0 | 20 | waitForNetworkEvents(aMonitor, 2).then(() => { |
michael@0 | 21 | check(-1, false); |
michael@0 | 22 | |
michael@0 | 23 | RequestsMenu.focusLastVisibleItem(); |
michael@0 | 24 | check(1, true); |
michael@0 | 25 | RequestsMenu.focusFirstVisibleItem(); |
michael@0 | 26 | check(0, true); |
michael@0 | 27 | |
michael@0 | 28 | RequestsMenu.focusNextItem(); |
michael@0 | 29 | check(1, true); |
michael@0 | 30 | RequestsMenu.focusPrevItem(); |
michael@0 | 31 | check(0, true); |
michael@0 | 32 | |
michael@0 | 33 | RequestsMenu.focusItemAtDelta(+1); |
michael@0 | 34 | check(1, true); |
michael@0 | 35 | RequestsMenu.focusItemAtDelta(-1); |
michael@0 | 36 | check(0, true); |
michael@0 | 37 | |
michael@0 | 38 | RequestsMenu.focusItemAtDelta(+10); |
michael@0 | 39 | check(1, true); |
michael@0 | 40 | RequestsMenu.focusItemAtDelta(-10); |
michael@0 | 41 | check(0, true); |
michael@0 | 42 | |
michael@0 | 43 | aDebuggee.performRequests(18); |
michael@0 | 44 | return waitForNetworkEvents(aMonitor, 18); |
michael@0 | 45 | }) |
michael@0 | 46 | .then(() => { |
michael@0 | 47 | RequestsMenu.focusLastVisibleItem(); |
michael@0 | 48 | check(19, true); |
michael@0 | 49 | RequestsMenu.focusFirstVisibleItem(); |
michael@0 | 50 | check(0, true); |
michael@0 | 51 | |
michael@0 | 52 | RequestsMenu.focusNextItem(); |
michael@0 | 53 | check(1, true); |
michael@0 | 54 | RequestsMenu.focusPrevItem(); |
michael@0 | 55 | check(0, true); |
michael@0 | 56 | |
michael@0 | 57 | RequestsMenu.focusItemAtDelta(+10); |
michael@0 | 58 | check(10, true); |
michael@0 | 59 | RequestsMenu.focusItemAtDelta(-10); |
michael@0 | 60 | check(0, true); |
michael@0 | 61 | |
michael@0 | 62 | RequestsMenu.focusItemAtDelta(+100); |
michael@0 | 63 | check(19, true); |
michael@0 | 64 | RequestsMenu.focusItemAtDelta(-100); |
michael@0 | 65 | check(0, true); |
michael@0 | 66 | |
michael@0 | 67 | teardown(aMonitor).then(finish); |
michael@0 | 68 | }); |
michael@0 | 69 | |
michael@0 | 70 | let count = 0; |
michael@0 | 71 | |
michael@0 | 72 | function check(aSelectedIndex, aPaneVisibility) { |
michael@0 | 73 | info("Performing check " + (count++) + "."); |
michael@0 | 74 | |
michael@0 | 75 | is(RequestsMenu.selectedIndex, aSelectedIndex, |
michael@0 | 76 | "The selected item in the requests menu was incorrect."); |
michael@0 | 77 | is(NetMonitorView.detailsPaneHidden, !aPaneVisibility, |
michael@0 | 78 | "The network requests details pane visibility state was incorrect."); |
michael@0 | 79 | } |
michael@0 | 80 | |
michael@0 | 81 | aDebuggee.performRequests(2); |
michael@0 | 82 | }); |
michael@0 | 83 | } |