• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// META: script=performanceobservers.js
2
3  async_test(function (t) {
4    var observer = new PerformanceObserver(
5        t.step_func(function (entryList, obs) {
6          checkEntries(entryList.getEntries(),
7            [{ entryType: "mark", name: "mark1"}], "getEntries");
8
9          checkEntries(entryList.getEntriesByType("mark"),
10            [{ entryType: "mark", name: "mark1"}], "getEntriesByType");
11          assert_equals(entryList.getEntriesByType("measure").length, 0,
12           "getEntriesByType with no expected entry");
13          assert_equals(entryList.getEntriesByType("234567").length, 0,
14           "getEntriesByType with no expected entry");
15
16          checkEntries(entryList.getEntriesByName("mark1"),
17            [{ entryType: "mark", name: "mark1"}], "getEntriesByName");
18          assert_equals(entryList.getEntriesByName("mark2").length, 0,
19            "getEntriesByName with no expected entry");
20          assert_equals(entryList.getEntriesByName("234567").length, 0,
21            "getEntriesByName with no expected entry");
22
23          checkEntries(entryList.getEntriesByName("mark1", "mark"),
24            [{ entryType: "mark", name: "mark1"}], "getEntriesByName with a type");
25          assert_equals(entryList.getEntriesByName("mark1", "measure").length, 0,
26            "getEntriesByName with a type with no expected entry");
27          assert_equals(entryList.getEntriesByName("mark2", "measure").length, 0,
28            "getEntriesByName with a type with no expected entry");
29          assert_equals(entryList.getEntriesByName("mark1", "234567").length, 0,
30            "getEntriesByName with a type with no expected entry");
31
32          observer.disconnect();
33          t.done();
34        })
35      );
36    observer.observe({entryTypes: ["mark"]});
37    self.performance.mark("mark1");
38  }, "getEntries, getEntriesByType and getEntriesByName work");
39