Bug 1330967 - Can not open Statistics view after switching between 2 views several times, r=Honza

MozReview-Commit-ID: J78OhW7my88

--HG--
extra : rebase_source : 3c4dada15fe22c2e76047dbc76bfc1807dcbc668
This commit is contained in:
steveck-chung 2017-01-16 17:27:52 +08:00
parent 21aea98345
commit 6eb9d9a171
4 changed files with 23 additions and 71 deletions

View File

@ -423,10 +423,6 @@ TargetEventsHandler.prototype = {
// If the log is persistent, just clear all accumulated timing markers. // If the log is persistent, just clear all accumulated timing markers.
gStore.dispatch(Actions.clearTimingMarkers()); gStore.dispatch(Actions.clearTimingMarkers());
} }
// Switch to the default network traffic inspector view.
if (NetMonitorController.getCurrentActivity() == ACTIVITY_TYPE.NONE) {
NetMonitorView.showNetworkInspectorView();
}
window.emit(EVENTS.TARGET_WILL_NAVIGATE); window.emit(EVENTS.TARGET_WILL_NAVIGATE);
break; break;

View File

@ -154,7 +154,6 @@ skip-if = true # Redundant for React/Redux version
[browser_net_sort-03.js] [browser_net_sort-03.js]
[browser_net_statistics-01.js] [browser_net_statistics-01.js]
[browser_net_statistics-02.js] [browser_net_statistics-02.js]
[browser_net_statistics-03.js]
[browser_net_status-codes.js] [browser_net_status-codes.js]
[browser_net_streaming-response.js] [browser_net_streaming-response.js]
[browser_net_throttle.js] [browser_net_throttle.js]

View File

@ -4,40 +4,43 @@
"use strict"; "use strict";
/** /**
* Tests if the network inspector view is shown when the target navigates * Test if the correct filtering predicates are used when filtering from
* away while in the statistics view. * the performance analysis view.
*/ */
add_task(function* () { add_task(function* () {
let { tab, monitor } = yield initNetMonitor(STATISTICS_URL); let { monitor } = yield initNetMonitor(FILTERING_URL);
info("Starting test... "); info("Starting test... ");
let panel = monitor.panelWin; let panel = monitor.panelWin;
let { $, $all, EVENTS, NetMonitorView, gStore, windowRequire } = panel; let { $, $all, EVENTS, NetMonitorView, gStore, windowRequire } = panel;
let Actions = windowRequire("devtools/client/netmonitor/actions/index"); let Actions = windowRequire("devtools/client/netmonitor/actions/index");
is(NetMonitorView.currentFrontendMode, "network-inspector-view",
"The initial frontend mode is correct.");
let onChartDisplayed = Promise.all([ EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-html-button"));
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-css-button"));
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-js-button"));
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-ws-button"));
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-other-button"));
testFilterButtonsCustom(monitor, [0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1]);
info("The correct filtering predicates are used before entering perf. analysis mode.");
let onEvents = promise.all([
panel.once(EVENTS.PRIMED_CACHE_CHART_DISPLAYED), panel.once(EVENTS.PRIMED_CACHE_CHART_DISPLAYED),
panel.once(EVENTS.EMPTY_CACHE_CHART_DISPLAYED) panel.once(EVENTS.EMPTY_CACHE_CHART_DISPLAYED)
]); ]);
info("Displaying statistics view");
gStore.dispatch(Actions.openStatistics(true)); gStore.dispatch(Actions.openStatistics(true));
yield onChartDisplayed; yield onEvents;
is(NetMonitorView.currentFrontendMode, "network-statistics-view",
"The frontend mode is currently in the statistics view."); is(NetMonitorView.currentFrontendMode, "network-statistics-view",
"The frontend mode is switched to the statistics view.");
EventUtils.sendMouseEvent({ type: "click" }, $(".pie-chart-slice"));
info("Reloading page");
let onWillNavigate = panel.once(EVENTS.TARGET_WILL_NAVIGATE);
let onDidNavigate = panel.once(EVENTS.TARGET_DID_NAVIGATE);
tab.linkedBrowser.reload();
yield onWillNavigate;
is(NetMonitorView.currentFrontendMode, "network-inspector-view", is(NetMonitorView.currentFrontendMode, "network-inspector-view",
"The frontend mode switched back to the inspector view."); "The frontend mode is switched back to the inspector view.");
yield onDidNavigate;
is(NetMonitorView.currentFrontendMode, "network-inspector-view", testFilterButtons(monitor, "html");
"The frontend mode is still in the inspector view."); info("The correct filtering predicate is used when exiting perf. analysis mode.");
yield teardown(monitor); yield teardown(monitor);
}); });

View File

@ -1,46 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Test if the correct filtering predicates are used when filtering from
* the performance analysis view.
*/
add_task(function* () {
let { monitor } = yield initNetMonitor(FILTERING_URL);
info("Starting test... ");
let panel = monitor.panelWin;
let { $, $all, EVENTS, NetMonitorView, gStore, windowRequire } = panel;
let Actions = windowRequire("devtools/client/netmonitor/actions/index");
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-html-button"));
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-css-button"));
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-js-button"));
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-ws-button"));
EventUtils.sendMouseEvent({ type: "click" }, $("#requests-menu-filter-other-button"));
testFilterButtonsCustom(monitor, [0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1]);
info("The correct filtering predicates are used before entering perf. analysis mode.");
let onEvents = promise.all([
panel.once(EVENTS.PRIMED_CACHE_CHART_DISPLAYED),
panel.once(EVENTS.EMPTY_CACHE_CHART_DISPLAYED)
]);
gStore.dispatch(Actions.openStatistics(true));
yield onEvents;
is(NetMonitorView.currentFrontendMode, "network-statistics-view",
"The frontend mode is switched to the statistics view.");
EventUtils.sendMouseEvent({ type: "click" }, $(".pie-chart-slice"));
is(NetMonitorView.currentFrontendMode, "network-inspector-view",
"The frontend mode is switched back to the inspector view.");
testFilterButtons(monitor, "html");
info("The correct filtering predicate is used when exiting perf. analysis mode.");
yield teardown(monitor);
});