summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/performance-timeline/po-mark-measure.any.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/performance-timeline/po-mark-measure.any.js
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/performance-timeline/po-mark-measure.any.js')
-rw-r--r--testing/web-platform/tests/performance-timeline/po-mark-measure.any.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/testing/web-platform/tests/performance-timeline/po-mark-measure.any.js b/testing/web-platform/tests/performance-timeline/po-mark-measure.any.js
new file mode 100644
index 0000000000..0b205e094c
--- /dev/null
+++ b/testing/web-platform/tests/performance-timeline/po-mark-measure.any.js
@@ -0,0 +1,61 @@
+// META: script=performanceobservers.js
+
+ async_test(function (t) {
+ var stored_entries = [];
+ var observer = new PerformanceObserver(
+ t.step_func(function (entryList, obs) {
+ stored_entries =
+ stored_entries.concat(entryList.getEntries());
+ if (stored_entries.length >= 4) {
+ checkEntries(stored_entries,
+ [{ entryType: "mark", name: "mark1"},
+ { entryType: "mark", name: "mark2"},
+ { entryType: "measure", name: "measure1"},
+ { entryType: "measure", name: "measure2"}]);
+ observer.disconnect();
+ t.done();
+ }
+ })
+ );
+ observer.observe({entryTypes: ["mark", "measure"]});
+ }, "entries are observable");
+
+ async_test(function (t) {
+ var mark_entries = [];
+ var observer = new PerformanceObserver(
+ t.step_func(function (entryList, obs) {
+ mark_entries =
+ mark_entries.concat(entryList.getEntries());
+ if (mark_entries.length >= 2) {
+ checkEntries(mark_entries,
+ [{ entryType: "mark", name: "mark1"},
+ { entryType: "mark", name: "mark2"}]);
+ observer.disconnect();
+ t.done();
+ }
+ })
+ );
+ observer.observe({entryTypes: ["mark"]});
+ self.performance.mark("mark1");
+ self.performance.mark("mark2");
+ }, "mark entries are observable");
+
+ async_test(function (t) {
+ var measure_entries = [];
+ var observer = new PerformanceObserver(
+ t.step_func(function (entryList, obs) {
+ measure_entries =
+ measure_entries.concat(entryList.getEntries());
+ if (measure_entries.length >= 2) {
+ checkEntries(measure_entries,
+ [{ entryType: "measure", name: "measure1"},
+ { entryType: "measure", name: "measure2"}]);
+ observer.disconnect();
+ t.done();
+ }
+ })
+ );
+ observer.observe({entryTypes: ["measure"]});
+ self.performance.measure("measure1");
+ self.performance.measure("measure2");
+ }, "measure entries are observable");