Bug 1218560 - Part 2: Add an integration test for allocation stack breakdowns; r=jsantell
☠☠ backed out by 205846a3aef5 ☠ ☠
authorNick Fitzgerald <fitzgen@gmail.com>
Wed, 28 Oct 2015 02:11:06 -0700
changeset 269935 2e2f56672850b6f218e31ac80774b0d1d008bb16
parent 269934 2e4f2de05673ffe225fda71140e7249e4cb76df7
child 269936 167cd2f19d9368498359f528df23acde21fc5b16
push id29595
push userkwierso@gmail.com
push dateWed, 28 Oct 2015 23:41:46 +0000
treeherdermozilla-central@769f29c92bb2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjsantell
bugs1218560
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1218560 - Part 2: Add an integration test for allocation stack breakdowns; r=jsantell
devtools/client/memory/initializer.js
devtools/client/memory/test/browser/browser.ini
devtools/client/memory/test/browser/browser_memory_allocationStackBreakdown_01.js
--- a/devtools/client/memory/initializer.js
+++ b/devtools/client/memory/initializer.js
@@ -33,10 +33,11 @@ function initialize () {
       heapWorker: gHeapAnalysesClient
     });
     gProvider = createElement(Provider, { store: gStore }, gApp);
     render(gProvider, gRoot);
   });
 }
 
 function destroy () {
+  gRoot = gStore = gApp = gProvider = null;
   return Task.spawn(function*(){});
 }
--- a/devtools/client/memory/test/browser/browser.ini
+++ b/devtools/client/memory/test/browser/browser.ini
@@ -1,9 +1,11 @@
 [DEFAULT]
 tags = devtools
 subsuite = devtools
 support-files =
   head.js
+  doc_steady_allocation.html
 
+[browser_memory_allocationStackBreakdown_01.js]
 [browser_memory-breakdowns-01.js]
 [browser_memory-simple-01.js]
 [browser_memory_transferHeapSnapshot_e10s_01.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/memory/test/browser/browser_memory_allocationStackBreakdown_01.js
@@ -0,0 +1,39 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Sanity test that we can show allocation stack breakdowns in the tree.
+
+"use strict";
+
+const { waitForTime } = require("devtools/shared/DevToolsUtils");
+const { breakdowns } = require("devtools/client/memory/constants");
+const { toggleRecordingAllocationStacks } = require("devtools/client/memory/actions/allocations");
+const { takeSnapshotAndCensus } = require("devtools/client/memory/actions/snapshot");
+const breakdownActions = require("devtools/client/memory/actions/breakdown");
+const { toggleInverted } = require("devtools/client/memory/actions/inverted");
+
+const TEST_URL = "http://example.com/browser/devtools/client/memory/test/browser/doc_steady_allocation.html";
+
+this.test = makeMemoryTest(TEST_URL, function* ({ tab, panel }) {
+  const heapWorker = panel.panelWin.gHeapAnalysesClient;
+  const front = panel.panelWin.gFront;
+  const { getState, dispatch } = panel.panelWin.gStore;
+
+  dispatch(toggleInverted());
+  ok(getState().inverted, true);
+
+  dispatch(breakdownActions.setBreakdown(breakdowns.allocationStack.breakdown));
+  is(getState().breakdown.by, "allocationStack");
+
+  yield dispatch(toggleRecordingAllocationStacks(front));
+  ok(getState().allocations.recording);
+
+  // Let some allocations build up.
+  yield waitForTime(500);
+
+  yield dispatch(takeSnapshotAndCensus(front, heapWorker));
+
+  const doc = panel.panelWin.document;
+  ok(doc.querySelector(".heap-tree-item-function-display-name"),
+     "Should have rendered some allocation stack tree items");
+});