Bug 1315635 - Netmonitor Performance View: fixed name of enableFilterTypeOnly action r?Honza draft
authorJarda Snajdr <jsnajdr@gmail.com>
Mon, 07 Nov 2016 12:59:06 +0100
changeset 434805 69f5f24a8b06a80f20e14db58de5e32f57470b6f
parent 434636 908557c762f798605a2f96e4c943791cbada1b50
child 434809 6f4466d4ca5ed81167d066e9c26b10292fd6998c
push id34831
push userbmo:jsnajdr@gmail.com
push dateMon, 07 Nov 2016 11:59:41 +0000
reviewersHonza
bugs1315635
milestone52.0a1
Bug 1315635 - Netmonitor Performance View: fixed name of enableFilterTypeOnly action r?Honza MozReview-Commit-ID: 5ZsDSXseiOA
devtools/client/netmonitor/performance-statistics-view.js
devtools/client/netmonitor/test/browser_net_statistics-03.js
devtools/client/netmonitor/test/head.js
--- a/devtools/client/netmonitor/performance-statistics-view.js
+++ b/devtools/client/netmonitor/performance-statistics-view.js
@@ -139,17 +139,17 @@ PerformanceStatisticsView.prototype = {
       data: data,
       strings: strings,
       totals: totals,
       sorted: sorted
     });
 
     chart.on("click", (_, item) => {
       // Reset FilterButtons and enable one filter exclusively
-      this.store.dispatch(Actions.enableFilterOnly(item.label));
+      this.store.dispatch(Actions.enableFilterTypeOnly(item.label));
       NetMonitorView.showNetworkInspectorView();
     });
 
     container.appendChild(chart.node);
   },
 
   /**
    * Sanitizes the data source used for creating charts, to follow the
--- a/devtools/client/netmonitor/test/browser_net_statistics-03.js
+++ b/devtools/client/netmonitor/test/browser_net_statistics-03.js
@@ -25,14 +25,21 @@ add_task(function* () {
 
   let onEvents = promise.all([
     panel.once(EVENTS.PRIMED_CACHE_CHART_DISPLAYED),
     panel.once(EVENTS.EMPTY_CACHE_CHART_DISPLAYED)
   ]);
   NetMonitorView.toggleFrontendMode();
   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);
 });
--- a/devtools/client/netmonitor/test/head.js
+++ b/devtools/client/netmonitor/test/head.js
@@ -377,27 +377,29 @@ function waitFor(subject, eventName) {
   let deferred = promise.defer();
   subject.once(eventName, deferred.resolve);
   return deferred.promise;
 }
 
 /**
  * Tests if a button for a filter of given type is the only one checked.
  *
- * @param string aFilterType
+ * @param string filterType
  *        The type of the filter that should be the only one checked.
  */
-function testFilterButtons(aMonitor, aFilterType) {
-  let doc = aMonitor.panelWin.document;
-  let target = doc.querySelector("#requests-menu-filter-" + aFilterType + "-button");
-  let buttons = doc.querySelectorAll(".requests-menu-footer-button");
+function testFilterButtons(monitor, filterType) {
+  let doc = monitor.panelWin.document;
+  let target = doc.querySelector("#requests-menu-filter-" + filterType + "-button");
+  ok(target, `Filter button '${filterType}' was found`);
+  let buttons = [...doc.querySelectorAll(".menu-filter-button")];
+  ok(buttons.length > 0, "More than zero filter buttons were found");
 
   // Only target should be checked.
-  let checkStatus = [...buttons].map(button => button == target ? 1 : 0);
-  testFilterButtonsCustom(aMonitor, checkStatus);
+  let checkStatus = buttons.map(button => button == target ? 1 : 0);
+  testFilterButtonsCustom(monitor, checkStatus);
 }
 
 /**
  * Tests if filter buttons have 'checked' attributes set correctly.
  *
  * @param array aIsChecked
  *        An array specifying if a button at given index should have a
  *        'checked' attribute. For example, if the third item of the array