• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1test(function()
2{
3    self.performance.mark("mark1");
4    self.performance.measure("measure1", "mark1");
5    self.performance.mark("mark2");
6    self.performance.measure("measure2", "mark2");
7
8    // test that two measures have been created
9    var entries = self.performance.getEntriesByType("measure");
10    assert_equals(entries.length, 2, "Two measures have been created for this test.");
11
12    // clear non-existent measure
13    self.performance.clearMeasures("measure3");
14
15    // test that "measure1" still exists
16    entries = self.performance.getEntriesByName("measure1");
17    assert_equals(entries[0].name, "measure1",
18              "After a call to self.performance.clearMeasures(\"measure3\"), where \"measure3" +
19              "\" is a non-existent measure, self.performance.getEntriesByName(\"measure1\") " +
20              "returns an object containing the \"measure1\" measure.");
21
22    // test that "measure2" still exists
23    entries = self.performance.getEntriesByName("measure2");
24    assert_equals(entries[0].name, "measure2",
25              "After a call to self.performance.clearMeasures(\"measure3\"), where \"measure3" +
26              "\" is a non-existent measure, self.performance.getEntriesByName(\"measure2\") " +
27              "returns an object containing the \"measure2\" measure.");
28
29}, "Clearing a non-existent measure doesn't affect existing measures");
30