tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

clear_one_measure.any.js (1230B)


      1 test(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 existent measure
     13    self.performance.clearMeasures("measure1");
     14 
     15    // test that "measure1" was cleared
     16    entries = self.performance.getEntriesByName("measure1");
     17 
     18    assert_equals(entries.length, 0,
     19              "After a call to self.performance.clearMeasures(\"measure1\"), " +
     20              "self.performance.getEntriesByName(\"measure1\") returns an empty object.");
     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(\"measure1\"), " +
     26              "self.performance.getEntriesByName(\"measure2\") returns an object containing the " +
     27              "\"measure2\" measure.");
     28 
     29 }, "Clearing an existent measure doesn't affect other existing measures");