summaryrefslogtreecommitdiffstats
path: root/devtools/client/performance/test/browser_timeline-waterfall-rerender.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/client/performance/test/browser_timeline-waterfall-rerender.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/performance/test/browser_timeline-waterfall-rerender.js')
-rw-r--r--devtools/client/performance/test/browser_timeline-waterfall-rerender.js76
1 files changed, 76 insertions, 0 deletions
diff --git a/devtools/client/performance/test/browser_timeline-waterfall-rerender.js b/devtools/client/performance/test/browser_timeline-waterfall-rerender.js
new file mode 100644
index 000000000..8bf842560
--- /dev/null
+++ b/devtools/client/performance/test/browser_timeline-waterfall-rerender.js
@@ -0,0 +1,76 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+/* eslint-disable */
+/**
+ * Tests if the waterfall remembers the selection when rerendering.
+ */
+
+function* spawnTest() {
+ let { target, panel } = yield initPerformance(SIMPLE_URL);
+ let { $, $$, EVENTS, PerformanceController, OverviewView, WaterfallView } = panel.panelWin;
+
+ const MIN_MARKERS_COUNT = 50;
+ const MAX_MARKERS_SELECT = 20;
+
+ yield startRecording(panel);
+ ok(true, "Recording has started.");
+
+ let updated = 0;
+ OverviewView.on(EVENTS.UI_OVERVIEW_RENDERED, () => updated++);
+
+ ok((yield waitUntil(() => updated > 0)),
+ "The overview graphs were updated a bunch of times.");
+ ok((yield waitUntil(() => PerformanceController.getCurrentRecording().getMarkers().length > MIN_MARKERS_COUNT)),
+ "There are some markers available.");
+
+ yield stopRecording(panel);
+ ok(true, "Recording has ended.");
+
+ let currentMarkers = PerformanceController.getCurrentRecording().getMarkers();
+ info("Gathered markers: " + JSON.stringify(currentMarkers, null, 2));
+
+ let initialBarsCount = $$(".waterfall-marker-bar").length;
+ info("Initial bars count: " + initialBarsCount);
+
+ // Select a portion of the overview.
+ let rerendered = WaterfallView.once(EVENTS.UI_WATERFALL_RENDERED);
+ OverviewView.setTimeInterval({ startTime: 0, endTime: currentMarkers[MAX_MARKERS_SELECT].end });
+ yield rerendered;
+
+ ok(!$(".waterfall-tree-item:focus"),
+ "There is no item focused in the waterfall yet.");
+ ok($("#waterfall-details").hidden,
+ "The waterfall sidebar is initially hidden.");
+
+ // Focus the second item in the tree.
+ WaterfallView._markersRoot.getChild(1).focus();
+
+ let beforeResizeBarsCount = $$(".waterfall-marker-bar").length;
+ info("Before resize bars count: " + beforeResizeBarsCount);
+ ok(beforeResizeBarsCount < initialBarsCount,
+ "A subset of the total markers was selected.");
+
+ is(Array.indexOf($$(".waterfall-tree-item"), $(".waterfall-tree-item:focus")), 2,
+ "The correct item was focused in the tree.");
+ ok(!$("#waterfall-details").hidden,
+ "The waterfall sidebar is now visible.");
+
+ // Simulate a resize on the marker details.
+ rerendered = WaterfallView.once(EVENTS.UI_WATERFALL_RENDERED);
+ EventUtils.sendMouseEvent({ type: "mouseup" }, WaterfallView.detailsSplitter);
+ yield rerendered;
+
+ let afterResizeBarsCount = $$(".waterfall-marker-bar").length;
+ info("After resize bars count: " + afterResizeBarsCount);
+ is(afterResizeBarsCount, beforeResizeBarsCount,
+ "The same subset of the total markers remained visible.");
+
+ is(Array.indexOf($$(".waterfall-tree-item"), $(".waterfall-tree-item:focus")), 2,
+ "The correct item is still focused in the tree.");
+ ok(!$("#waterfall-details").hidden,
+ "The waterfall sidebar is still visible.");
+
+ yield teardown(panel);
+ finish();
+}
+/* eslint-enable */