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.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Tests if toggling the details pane works as expected.
6 */
8 function test() {
9 initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => {
10 info("Starting test... ");
12 let { document, NetMonitorView } = aMonitor.panelWin;
13 let { RequestsMenu } = NetMonitorView;
15 RequestsMenu.lazyUpdate = false;
17 is(document.querySelector("#details-pane-toggle")
18 .hasAttribute("disabled"), true,
19 "The pane toggle button should be disabled when the frontend is opened.");
20 is(document.querySelector("#details-pane-toggle")
21 .hasAttribute("pane-collapsed"), true,
22 "The pane toggle button should indicate that the details pane is " +
23 "collapsed when the frontend is opened.");
24 is(NetMonitorView.detailsPaneHidden, true,
25 "The details pane should be hidden when the frontend is opened.");
26 is(RequestsMenu.selectedItem, null,
27 "There should be no selected item in the requests menu.");
29 aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.NETWORK_EVENT, () => {
30 is(document.querySelector("#details-pane-toggle")
31 .hasAttribute("disabled"), false,
32 "The pane toggle button should be enabled after the first request.");
33 is(document.querySelector("#details-pane-toggle")
34 .hasAttribute("pane-collapsed"), true,
35 "The pane toggle button should still indicate that the details pane is " +
36 "collapsed after the first request.");
37 is(NetMonitorView.detailsPaneHidden, true,
38 "The details pane should still be hidden after the first request.");
39 is(RequestsMenu.selectedItem, null,
40 "There should still be no selected item in the requests menu.");
42 EventUtils.sendMouseEvent({ type: "mousedown" },
43 document.getElementById("details-pane-toggle"));
45 is(document.querySelector("#details-pane-toggle")
46 .hasAttribute("disabled"), false,
47 "The pane toggle button should still be enabled after being pressed.");
48 is(document.querySelector("#details-pane-toggle")
49 .hasAttribute("pane-collapsed"), false,
50 "The pane toggle button should now indicate that the details pane is " +
51 "not collapsed anymore after being pressed.");
52 is(NetMonitorView.detailsPaneHidden, false,
53 "The details pane should not be hidden after toggle button was pressed.");
54 isnot(RequestsMenu.selectedItem, null,
55 "There should be a selected item in the requests menu.");
56 is(RequestsMenu.selectedIndex, 0,
57 "The first item should be selected in the requests menu.");
59 EventUtils.sendMouseEvent({ type: "mousedown" },
60 document.getElementById("details-pane-toggle"));
62 is(document.querySelector("#details-pane-toggle")
63 .hasAttribute("disabled"), false,
64 "The pane toggle button should still be enabled after being pressed again.");
65 is(document.querySelector("#details-pane-toggle")
66 .hasAttribute("pane-collapsed"), true,
67 "The pane toggle button should now indicate that the details pane is " +
68 "collapsed after being pressed again.");
69 is(NetMonitorView.detailsPaneHidden, true,
70 "The details pane should now be hidden after the toggle button was pressed again.");
71 is(RequestsMenu.selectedItem, null,
72 "There should now be no selected item in the requests menu.");
74 teardown(aMonitor).then(finish);
75 });
77 aDebuggee.location.reload();
78 });
79 }