summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests/browser/browser_markers-timestamp.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/server/tests/browser/browser_markers-timestamp.js')
-rw-r--r--devtools/server/tests/browser/browser_markers-timestamp.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/devtools/server/tests/browser/browser_markers-timestamp.js b/devtools/server/tests/browser/browser_markers-timestamp.js
new file mode 100644
index 0000000000..78ba01c813
--- /dev/null
+++ b/devtools/server/tests/browser/browser_markers-timestamp.js
@@ -0,0 +1,61 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Test that we get a "TimeStamp" marker.
+ */
+"use strict";
+
+const {
+ pmmConsoleMethod,
+ pmmInitWithBrowser,
+} = require("devtools/client/performance/test/helpers/profiler-mm-utils");
+const MARKER_NAME = "TimeStamp";
+
+add_task(async function() {
+ const target = await addTabTarget(MAIN_DOMAIN + "doc_perf.html");
+
+ const front = await target.getFront("performance");
+ const rec = await front.startRecording({ withMarkers: true });
+
+ pmmInitWithBrowser(gBrowser);
+ pmmConsoleMethod("timeStamp");
+ pmmConsoleMethod("timeStamp", "myLabel");
+
+ const markers = await waitForMarkerType(
+ front,
+ MARKER_NAME,
+ m => m.length >= 2
+ );
+
+ await front.stopRecording(rec);
+
+ ok(
+ markers.every(({ stack }) => typeof stack === "number"),
+ "All markers have stack references."
+ );
+ ok(
+ markers.every(({ name }) => name === "TimeStamp"),
+ "All markers found are TimeStamp markers"
+ );
+ ok(markers.length === 2, "found 2 TimeStamp markers");
+ ok(
+ markers.every(
+ ({ start, end }) => typeof start === "number" && start === end
+ ),
+ "All markers have equal start and end times"
+ );
+ is(
+ markers[0].causeName,
+ void 0,
+ "Unlabeled timestamps have an empty causeName"
+ );
+ is(
+ markers[1].causeName,
+ "myLabel",
+ "Labeled timestamps have correct causeName"
+ );
+
+ await target.destroy();
+ gBrowser.removeCurrentTab();
+});