Bug 1218468 - Remove worker markers on each check in browser_timelineMarkers-02.js, r=me
authorVictor Porof <vporof@mozilla.com>
Wed, 28 Oct 2015 11:08:13 +0100
changeset 305103 a6dcceafce9c3279fbba099f8c439934333b00d7
parent 305102 594d0213bc5c87f2286ddb8ae486dc3f8e5b9ac5
child 305104 40ef1c5ebb786b7f172d1f3ff53087b33cf94901
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1218468
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1218468 - Remove worker markers on each check in browser_timelineMarkers-02.js, r=me
docshell/test/browser/browser_timelineMarkers-frame-02.js
--- a/docshell/test/browser/browser_timelineMarkers-frame-02.js
+++ b/docshell/test/browser/browser_timelineMarkers-frame-02.js
@@ -6,24 +6,31 @@
 // Test that the docShell profile timeline API returns the right markers when
 // restyles, reflows and paints occur
 
 function rectangleContains(rect, x, y, width, height) {
   return rect.x <= x && rect.y <= y && rect.width >= width &&
     rect.height >= height;
 }
 
+function sanitizeMarkers(list) {
+  // Worker markers are currently gathered from all docshells, which may
+  // interfere with this test.
+  return list.filter(e => e.name != "Worker")
+}
+
 var TESTS = [{
   desc: "Changing the width of the test element",
   searchFor: "Paint",
   setup: function(docShell) {
     let div = content.document.querySelector("div");
     div.setAttribute("class", "resize-change-color");
   },
   check: function(markers) {
+    markers = sanitizeMarkers(markers);
     ok(markers.length > 0, "markers were returned");
     console.log(markers);
     info(JSON.stringify(markers.filter(m => m.name == "Paint")));
     ok(markers.some(m => m.name == "Reflow"), "markers includes Reflow");
     ok(markers.some(m => m.name == "Paint"), "markers includes Paint");
     for (let marker of markers.filter(m => m.name == "Paint")) {
       // This change should generate at least one rectangle.
       ok(marker.rectangles.length >= 1, "marker has one rectangle");
@@ -35,16 +42,17 @@ var TESTS = [{
 }, {
   desc: "Changing the test element's background color",
   searchFor: "Paint",
   setup: function(docShell) {
     let div = content.document.querySelector("div");
     div.setAttribute("class", "change-color");
   },
   check: function(markers) {
+    markers = sanitizeMarkers(markers);
     ok(markers.length > 0, "markers were returned");
     ok(!markers.some(m => m.name == "Reflow"), "markers doesn't include Reflow");
     ok(markers.some(m => m.name == "Paint"), "markers includes Paint");
     for (let marker of markers.filter(m => m.name == "Paint")) {
       // This change should generate at least one rectangle.
       ok(marker.rectangles.length >= 1, "marker has one rectangle");
       // One of the rectangles should contain the div.
       ok(marker.rectangles.some(r => rectangleContains(r, 0, 0, 50, 50)));
@@ -54,16 +62,17 @@ var TESTS = [{
 }, {
   desc: "Changing the test element's classname",
   searchFor: "Paint",
   setup: function(docShell) {
     let div = content.document.querySelector("div");
     div.setAttribute("class", "change-color add-class");
   },
   check: function(markers) {
+    markers = sanitizeMarkers(markers);
     ok(markers.length > 0, "markers were returned");
     ok(!markers.some(m => m.name == "Reflow"), "markers doesn't include Reflow");
     ok(!markers.some(m => m.name == "Paint"), "markers doesn't include Paint");
     ok(markers.some(m => m.name == "Styles"), "markers includes Restyle");
   }
 }, {
   desc: "sync console.time/timeEnd",
   searchFor: "ConsoleTime",
@@ -79,16 +88,17 @@ var TESTS = [{
       content.console.time("BAR");
       content.setTimeout(() => {
         content.console.timeEnd("FOO");
         content.console.timeEnd("BAR");
       }, 100);
     }, 100);
   },
   check: function(markers) {
+    markers = sanitizeMarkers(markers);
     is(markers.length, 2, "Got 2 markers");
     is(markers[0].name, "ConsoleTime", "Got first ConsoleTime marker");
     is(markers[0].causeName, "FOO", "Got ConsoleTime FOO detail");
     is(markers[1].name, "ConsoleTime", "Got second ConsoleTime marker");
     is(markers[1].causeName, "BAR", "Got ConsoleTime BAR detail");
   }
 }, {
   desc: "Timestamps created by console.timeStamp()",
@@ -100,17 +110,17 @@ var TESTS = [{
     is(markers[0].name, "TimeStamp", "Got Timestamp marker");
     is(markers[0].causeName, "rock", "Got Timestamp label value");
     content.console.timeStamp("paper");
     content.console.timeStamp("scissors");
     content.console.timeStamp();
     content.console.timeStamp(undefined);
   },
   check: function (markers) {
-    markers = markers.filter(e => e.name != "Worker");
+    markers = sanitizeMarkers(markers);
     is(markers.length, 4, "Got 4 markers");
     is(markers[0].name, "TimeStamp", "Got Timestamp marker");
     is(markers[0].causeName, "paper", "Got Timestamp label value");
     is(markers[1].name, "TimeStamp", "Got Timestamp marker");
     is(markers[1].causeName, "scissors", "Got Timestamp label value");
     is(markers[2].name, "TimeStamp", "Got empty Timestamp marker when no argument given");
     is(markers[2].causeName, void 0, "Got empty Timestamp label value");
     is(markers[3].name, "TimeStamp", "Got empty Timestamp marker when argument is undefined");