• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  test(function () {
2    assert_equals(typeof self.performance, "object");
3    assert_equals(typeof self.performance.getEntriesByType, "function");
4    var lowerList = self.performance.getEntriesByType("resource");
5    var upperList = self.performance.getEntriesByType("RESOURCE");
6    var mixedList = self.performance.getEntriesByType("ReSoUrCe");
7
8    assert_not_equals(lowerList.length, 0, "Resource entries exist");
9    assert_equals(upperList.length, 0, "getEntriesByType('RESOURCE').length");
10    assert_equals(mixedList.length, 0, "getEntriesByType('ReSoUrCe').length");
11
12  }, "getEntriesByType values are case sensitive");
13
14  test(function () {
15    assert_equals(typeof self.performance, "object");
16    assert_equals(typeof self.performance.getEntriesByName, "function");
17    var origin = self.location.protocol + "//" + self.location.host;
18    var location1 = origin.toUpperCase() + "/resources/testharness.js";
19    var location2 = self.location.protocol + "//"
20     + self.location.host.toUpperCase() + "/resources/testharness.js";
21    var lowerList = self.performance.getEntriesByName(origin + "/resources/testharness.js");
22    var upperList = self.performance.getEntriesByName(location1);
23    var mixedList = self.performance.getEntriesByName(location2);
24
25    assert_equals(lowerList.length, 1, "Resource entry exist");
26    assert_equals(upperList.length, 0, "getEntriesByName('" + location1 + "').length");
27    assert_equals(mixedList.length, 0, "getEntriesByName('" + location2 + "').length");
28
29  }, "getEntriesByName values are case sensitive");
30
31  async_test(function (t) {
32    // Test type/buffered case sensitivity.
33    observer = new PerformanceObserver(
34      t.step_func(function (entryList, obs) {
35        assert_unreached("Observer(type) should not be called.");
36      })
37    );
38    observer.observe({type: "Mark"});
39    observer.observe({type: "Measure"});
40    observer.observe({type: "MARK"});
41    observer.observe({type: "MEASURE"});
42    observer.observe({type: "Mark", buffered: true});
43    observer.observe({type: "Measure", buffered: true});
44    observer.observe({type: "MARK", buffered: true});
45    observer.observe({type: "MEASURE", buffered: true});
46    self.performance.mark("mark1");
47    self.performance.measure("measure1");
48
49    // Test entryTypes case sensitivity.
50    observer = new PerformanceObserver(
51      t.step_func(function (entryList, obs) {
52        assert_unreached("Observer(entryTypes) should not be called.");
53      })
54    );
55    observer.observe({entryTypes: ["Mark", "Measure"]});
56    observer.observe({entryTypes: ["MARK", "MEASURE"]});
57    self.performance.mark("mark1");
58    self.performance.measure("measure1");
59
60    t.step_timeout(function() {
61      t.done();
62    }, 1000);
63
64  }, "observe() and case sensitivity for types/entryTypes and buffered.");
65