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 requests are handled correctly.
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("#requests-menu-empty-notice")
21 .hasAttribute("hidden"), false,
22 "An empty notice should be displayed when the frontend is opened.");
23 is(RequestsMenu.itemCount, 0,
24 "The requests menu should be empty when the frontend is opened.");
25 is(NetMonitorView.detailsPaneHidden, true,
26 "The details pane should be hidden when the frontend is opened.");
28 aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.NETWORK_EVENT, () => {
29 is(document.querySelector("#details-pane-toggle")
30 .hasAttribute("disabled"), false,
31 "The pane toggle button should be enabled after the first request.");
32 is(document.querySelector("#requests-menu-empty-notice")
33 .hasAttribute("hidden"), true,
34 "The empty notice should be hidden after the first request.");
35 is(RequestsMenu.itemCount, 1,
36 "The requests menu should not be empty after the first request.");
37 is(NetMonitorView.detailsPaneHidden, true,
38 "The details pane should still be hidden after the first request.");
40 aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.NETWORK_EVENT, () => {
41 is(document.querySelector("#details-pane-toggle")
42 .hasAttribute("disabled"), false,
43 "The pane toggle button should be still be enabled after a reload.");
44 is(document.querySelector("#requests-menu-empty-notice")
45 .hasAttribute("hidden"), true,
46 "The empty notice should be still hidden after a reload.");
47 is(RequestsMenu.itemCount, 1,
48 "The requests menu should not be empty after a reload.");
49 is(NetMonitorView.detailsPaneHidden, true,
50 "The details pane should still be hidden after a reload.");
52 teardown(aMonitor).then(finish);
53 });
55 aDebuggee.location.reload();
56 });
58 aDebuggee.location.reload();
59 });
60 }