summaryrefslogtreecommitdiffstats
path: root/devtools/client/performance/test/browser_timeline-waterfall-sidebar.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-sidebar.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-sidebar.js')
-rw-r--r--devtools/client/performance/test/browser_timeline-waterfall-sidebar.js77
1 files changed, 77 insertions, 0 deletions
diff --git a/devtools/client/performance/test/browser_timeline-waterfall-sidebar.js b/devtools/client/performance/test/browser_timeline-waterfall-sidebar.js
new file mode 100644
index 000000000..1c2c1ccae
--- /dev/null
+++ b/devtools/client/performance/test/browser_timeline-waterfall-sidebar.js
@@ -0,0 +1,77 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+/* eslint-disable */
+/**
+ * Tests if the sidebar is properly updated when a marker is selected.
+ */
+
+function* spawnTest() {
+ let { target, panel } = yield initPerformance(SIMPLE_URL);
+ let { $, $$, PerformanceController, WaterfallView } = panel.panelWin;
+ let { L10N } = require("devtools/client/performance/modules/global");
+ let { MarkerBlueprintUtils } = require("devtools/client/performance/modules/marker-blueprint-utils");
+
+ // Hijack the markers massaging part of creating the waterfall view,
+ // to prevent collapsing markers and allowing this test to verify
+ // everything individually. A better solution would be to just expand
+ // all markers first and then skip the meta nodes, but I'm lazy.
+ WaterfallView._prepareWaterfallTree = markers => {
+ return { submarkers: markers };
+ };
+
+ yield startRecording(panel);
+ ok(true, "Recording has started.");
+
+ yield waitUntil(() => {
+ // Wait until we get 3 different markers.
+ let markers = PerformanceController.getCurrentRecording().getMarkers();
+ return markers.some(m => m.name == "Styles") &&
+ markers.some(m => m.name == "Reflow") &&
+ markers.some(m => m.name == "Paint");
+ });
+
+ yield stopRecording(panel);
+ ok(true, "Recording has ended.");
+
+ info("No need to select everything in the timeline.");
+ info("All the markers should be displayed by default.");
+
+ let bars = $$(".waterfall-marker-bar");
+ let markers = PerformanceController.getCurrentRecording().getMarkers();
+
+ info(`Got ${bars.length} bars and ${markers.length} markers.`);
+ info("Markers types from datasrc: " + Array.map(markers, e => e.name));
+ info("Markers names from sidebar: " + Array.map(bars, e => e.parentNode.parentNode.querySelector(".waterfall-marker-name").getAttribute("value")));
+
+ ok(bars.length > 2, "Got at least 3 markers (1)");
+ ok(markers.length > 2, "Got at least 3 markers (2)");
+
+ let toMs = ms => L10N.getFormatStrWithNumbers("timeline.tick", ms);
+
+ for (let i = 0; i < bars.length; i++) {
+ let bar = bars[i];
+ let mkr = markers[i];
+ EventUtils.sendMouseEvent({ type: "mousedown" }, bar);
+
+ let type = $(".marker-details-type").getAttribute("value");
+ let tooltip = $(".marker-details-duration").getAttribute("tooltiptext");
+ let duration = $(".marker-details-duration .marker-details-labelvalue").getAttribute("value");
+
+ info("Current marker data: " + mkr.toSource());
+ info("Current marker output: " + $("#waterfall-details").innerHTML);
+
+ is(type, MarkerBlueprintUtils.getMarkerLabel(mkr), "Sidebar title matches markers name.");
+
+ // Values are rounded. We don't use a strict equality.
+ is(toMs(mkr.end - mkr.start), duration, "Sidebar duration is valid.");
+
+ // For some reason, anything that creates "→" here turns it into a "â" for some reason.
+ // So just check that start and end time are in there somewhere.
+ ok(tooltip.indexOf(toMs(mkr.start)) !== -1, "Tooltip has start time.");
+ ok(tooltip.indexOf(toMs(mkr.end)) !== -1, "Tooltip has end time.");
+ }
+
+ yield teardown(panel);
+ finish();
+}
+/* eslint-enable */