michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests if requests are handled correctly. michael@0: */ michael@0: michael@0: function test() { michael@0: initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => { michael@0: info("Starting test... "); michael@0: michael@0: let { document, NetMonitorView } = aMonitor.panelWin; michael@0: let { RequestsMenu } = NetMonitorView; michael@0: michael@0: RequestsMenu.lazyUpdate = false; michael@0: michael@0: is(document.querySelector("#details-pane-toggle") michael@0: .hasAttribute("disabled"), true, michael@0: "The pane toggle button should be disabled when the frontend is opened."); michael@0: is(document.querySelector("#requests-menu-empty-notice") michael@0: .hasAttribute("hidden"), false, michael@0: "An empty notice should be displayed when the frontend is opened."); michael@0: is(RequestsMenu.itemCount, 0, michael@0: "The requests menu should be empty when the frontend is opened."); michael@0: is(NetMonitorView.detailsPaneHidden, true, michael@0: "The details pane should be hidden when the frontend is opened."); michael@0: michael@0: aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.NETWORK_EVENT, () => { michael@0: is(document.querySelector("#details-pane-toggle") michael@0: .hasAttribute("disabled"), false, michael@0: "The pane toggle button should be enabled after the first request."); michael@0: is(document.querySelector("#requests-menu-empty-notice") michael@0: .hasAttribute("hidden"), true, michael@0: "The empty notice should be hidden after the first request."); michael@0: is(RequestsMenu.itemCount, 1, michael@0: "The requests menu should not be empty after the first request."); michael@0: is(NetMonitorView.detailsPaneHidden, true, michael@0: "The details pane should still be hidden after the first request."); michael@0: michael@0: aMonitor.panelWin.once(aMonitor.panelWin.EVENTS.NETWORK_EVENT, () => { michael@0: is(document.querySelector("#details-pane-toggle") michael@0: .hasAttribute("disabled"), false, michael@0: "The pane toggle button should be still be enabled after a reload."); michael@0: is(document.querySelector("#requests-menu-empty-notice") michael@0: .hasAttribute("hidden"), true, michael@0: "The empty notice should be still hidden after a reload."); michael@0: is(RequestsMenu.itemCount, 1, michael@0: "The requests menu should not be empty after a reload."); michael@0: is(NetMonitorView.detailsPaneHidden, true, michael@0: "The details pane should still be hidden after a reload."); michael@0: michael@0: teardown(aMonitor).then(finish); michael@0: }); michael@0: michael@0: aDebuggee.location.reload(); michael@0: }); michael@0: michael@0: aDebuggee.location.reload(); michael@0: }); michael@0: }