Bug 1330967 - Can not open Statistics view after switching between 2 views several times, r?Honza draft
authorsteveck-chung <schung@mozilla.com>
Mon, 16 Jan 2017 17:27:52 +0800
changeset 462373 f822e155f19eb6efda7de105398fbd552f1b647c
parent 461121 8eaf154b385bbe0ff06155294ccf7962aa2d3324
child 542363 32024d28c39e95045e589d6d93496286a7747d52
push id41721
push userbmo:schung@mozilla.com
push dateTue, 17 Jan 2017 08:08:08 +0000
reviewersHonza
bugs1330967
milestone53.0a1
Bug 1330967 - Can not open Statistics view after switching between 2 views several times, r?Honza MozReview-Commit-ID: J78OhW7my88
devtools/client/netmonitor/netmonitor-controller.js
devtools/client/netmonitor/test/browser.ini
devtools/client/netmonitor/test/browser_net_statistics-02.js
devtools/client/netmonitor/test/browser_net_statistics-03.js
--- a/devtools/client/netmonitor/netmonitor-controller.js
+++ b/devtools/client/netmonitor/netmonitor-controller.js
@@ -418,20 +418,16 @@ TargetEventsHandler.prototype = {
       case "will-navigate": {
         // Reset UI.
         if (!Services.prefs.getBoolPref("devtools.webconsole.persistlog")) {
           NetMonitorView.RequestsMenu.reset();
         } else {
           // If the log is persistent, just clear all accumulated timing markers.
           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);
         break;
       }
       case "navigate": {
         window.emit(EVENTS.TARGET_DID_NAVIGATE);
         break;
       }
--- a/devtools/client/netmonitor/test/browser.ini
+++ b/devtools/client/netmonitor/test/browser.ini
@@ -142,17 +142,16 @@ skip-if = true # Bug 1258809
 skip-if = true # Bug 1258809
 [browser_net_simple-request.js]
 [browser_net_sort-01.js]
 skip-if = true # Redundant for React/Redux version
 [browser_net_sort-02.js]
 [browser_net_sort-03.js]
 [browser_net_statistics-01.js]
 [browser_net_statistics-02.js]
-[browser_net_statistics-03.js]
 [browser_net_status-codes.js]
 [browser_net_streaming-response.js]
 [browser_net_throttle.js]
 [browser_net_timeline_ticks.js]
 skip-if = true # TODO: fix the test
 [browser_net_timing-division.js]
 [browser_net_truncate.js]
 [browser_net_persistent_logs.js]
--- a/devtools/client/netmonitor/test/browser_net_statistics-02.js
+++ b/devtools/client/netmonitor/test/browser_net_statistics-02.js
@@ -1,43 +1,46 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 /**
- * Tests if the network inspector view is shown when the target navigates
- * away while in the statistics view.
+ * Test if the correct filtering predicates are used when filtering from
+ * the performance analysis view.
  */
 
 add_task(function* () {
-  let { tab, monitor } = yield initNetMonitor(STATISTICS_URL);
+  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");
-  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.EMPTY_CACHE_CHART_DISPLAYED)
   ]);
+  gStore.dispatch(Actions.openStatistics(true));
+  yield onEvents;
 
-  info("Displaying statistics view");
-  gStore.dispatch(Actions.openStatistics(true));
-  yield onChartDisplayed;
   is(NetMonitorView.currentFrontendMode, "network-statistics-view",
-        "The frontend mode is currently in the statistics view.");
+    "The frontend mode is switched to the statistics view.");
 
-  info("Reloading page");
-  let onWillNavigate = panel.once(EVENTS.TARGET_WILL_NAVIGATE);
-  let onDidNavigate = panel.once(EVENTS.TARGET_DID_NAVIGATE);
-  tab.linkedBrowser.reload();
-  yield onWillNavigate;
+  EventUtils.sendMouseEvent({ type: "click" }, $(".pie-chart-slice"));
+
   is(NetMonitorView.currentFrontendMode, "network-inspector-view",
-          "The frontend mode switched back to the inspector view.");
-  yield onDidNavigate;
-  is(NetMonitorView.currentFrontendMode, "network-inspector-view",
-            "The frontend mode is still in the 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);
 });
deleted file mode 100644
--- a/devtools/client/netmonitor/test/browser_net_statistics-03.js
+++ /dev/null
@@ -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);
-});