1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/netmonitor/test/browser_net_simple-request.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/** 1.8 + * Tests if requests are handled correctly. 1.9 + */ 1.10 + 1.11 +function test() { 1.12 + initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => { 1.13 + info("Starting test... "); 1.14 + 1.15 + let { document, NetMonitorView } = aMonitor.panelWin; 1.16 + let { RequestsMenu } = NetMonitorView; 1.17 + 1.18 + RequestsMenu.lazyUpdate = false; 1.19 + 1.20 + is(document.querySelector("#details-pane-toggle") 1.21 + .hasAttribute("disabled"), true, 1.22 + "The pane toggle button should be disabled when the frontend is opened."); 1.23 + is(document.querySelector("#requests-menu-empty-notice") 1.24 + .hasAttribute("hidden"), false, 1.25 + "An empty notice should be displayed when the frontend is opened."); 1.26 + is(RequestsMenu.itemCount, 0, 1.27 + "The requests menu should be empty when the frontend is opened."); 1.28 + is(NetMonitorView.detailsPaneHidden, true, 1.29 + "The details pane should be hidden when the frontend is opened."); 1.30 + 1.31 + aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.NETWORK_EVENT, () => { 1.32 + is(document.querySelector("#details-pane-toggle") 1.33 + .hasAttribute("disabled"), false, 1.34 + "The pane toggle button should be enabled after the first request."); 1.35 + is(document.querySelector("#requests-menu-empty-notice") 1.36 + .hasAttribute("hidden"), true, 1.37 + "The empty notice should be hidden after the first request."); 1.38 + is(RequestsMenu.itemCount, 1, 1.39 + "The requests menu should not be empty after the first request."); 1.40 + is(NetMonitorView.detailsPaneHidden, true, 1.41 + "The details pane should still be hidden after the first request."); 1.42 + 1.43 + aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.NETWORK_EVENT, () => { 1.44 + is(document.querySelector("#details-pane-toggle") 1.45 + .hasAttribute("disabled"), false, 1.46 + "The pane toggle button should be still be enabled after a reload."); 1.47 + is(document.querySelector("#requests-menu-empty-notice") 1.48 + .hasAttribute("hidden"), true, 1.49 + "The empty notice should be still hidden after a reload."); 1.50 + is(RequestsMenu.itemCount, 1, 1.51 + "The requests menu should not be empty after a reload."); 1.52 + is(NetMonitorView.detailsPaneHidden, true, 1.53 + "The details pane should still be hidden after a reload."); 1.54 + 1.55 + teardown(aMonitor).then(finish); 1.56 + }); 1.57 + 1.58 + aDebuggee.location.reload(); 1.59 + }); 1.60 + 1.61 + aDebuggee.location.reload(); 1.62 + }); 1.63 +}