Title: [250872] trunk/LayoutTests
Revision
250872
Author
yu...@chromium.org
Date
2019-10-08 16:03:02 -0700 (Tue, 08 Oct 2019)

Log Message

Web Inspector: inspector/layers/layers-for-node.html and  inspector/timeline/line-column.html are flaky
https://bugs.webkit.org/show_bug.cgi?id=202649

Reviewed by Devin Rousso.

Unflake a couple of inspector protocol tests. r250655 replaced Timer-based queue
with RunLoop-based one for inspector message dispatching. The tests apparently relied
on the timing of the message delivery and had been less flaky before. Updated the tests
to wait for explicit signals rather than relying on event timing.

* inspector/layers/layers-for-node-expected.txt:
* inspector/layers/layers-for-node.html: Updated the test to wait for the first
LayerTree.layerTreeDidChange event before requesting initial layer tree.

Also after adding a node wait for next RAF to avoid flakiness.

* inspector/timeline/line-column-expected.txt:
* inspector/timeline/line-column.html: There a style recalc event
which appears intermittently in the recorded profile making the test
flaky. To avoid that dump only events that are always present.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (250871 => 250872)


--- trunk/LayoutTests/ChangeLog	2019-10-08 23:01:58 UTC (rev 250871)
+++ trunk/LayoutTests/ChangeLog	2019-10-08 23:03:02 UTC (rev 250872)
@@ -1,3 +1,26 @@
+2019-10-08  Yury Semikhatsky  <yu...@chromium.org>
+
+        Web Inspector: inspector/layers/layers-for-node.html and  inspector/timeline/line-column.html are flaky
+        https://bugs.webkit.org/show_bug.cgi?id=202649
+
+        Reviewed by Devin Rousso.
+
+        Unflake a couple of inspector protocol tests. r250655 replaced Timer-based queue
+        with RunLoop-based one for inspector message dispatching. The tests apparently relied
+        on the timing of the message delivery and had been less flaky before. Updated the tests
+        to wait for explicit signals rather than relying on event timing.
+
+        * inspector/layers/layers-for-node-expected.txt:
+        * inspector/layers/layers-for-node.html: Updated the test to wait for the first
+        LayerTree.layerTreeDidChange event before requesting initial layer tree.
+
+        Also after adding a node wait for next RAF to avoid flakiness.
+
+        * inspector/timeline/line-column-expected.txt:
+        * inspector/timeline/line-column.html: There a style recalc event
+        which appears intermittently in the recorded profile making the test
+        flaky. To avoid that dump only events that are always present.
+
 2019-10-08  Kate Cheney  <katherine_che...@apple.com>
 
         Implement Telemetry and Dumping Routines for SQLite backend (195088)

Modified: trunk/LayoutTests/inspector/layers/layers-for-node-expected.txt (250871 => 250872)


--- trunk/LayoutTests/inspector/layers/layers-for-node-expected.txt	2019-10-08 23:01:58 UTC (rev 250871)
+++ trunk/LayoutTests/inspector/layers/layers-for-node-expected.txt	2019-10-08 23:03:02 UTC (rev 250872)
@@ -126,6 +126,10 @@
 
 PASS
 
+=== Wait for requestAnimationFrame ===
+
+PASS
+
 === Get the modified layer tree ===
 
 PASS

Modified: trunk/LayoutTests/inspector/layers/layers-for-node.html (250871 => 250872)


--- trunk/LayoutTests/inspector/layers/layers-for-node.html	2019-10-08 23:01:58 UTC (rev 250871)
+++ trunk/LayoutTests/inspector/layers/layers-for-node.html	2019-10-08 23:03:02 UTC (rev 250872)
@@ -9,33 +9,26 @@
     element.className = "composited";
     element.id = "last-element";
     document.body.appendChild(element);
+    return new Promise(resolve => requestAnimationFrame(resolve));
 };
 
 function test()
 {
-    var documentNode;
-    var initialLayers;
-    var eventsCount = 0;
+    let documentNode;
+    let initialLayers;
 
-    InspectorProtocol.eventHandler["LayerTree.layerTreeDidChange"] = function (messageObject) {
-        eventsCount++;
-    };
+    step({
+        name: "Enable the LayerTree agent",
+        command: "LayerTree.enable",
+        parameters: {},
+        callback: () => {}
+    });
 
-    enableLayerTreeAgent();
+    InspectorProtocol.awaitEvent({event: "LayerTree.layerTreeDidChange"}).then(getDocument);
 
-    function enableLayerTreeAgent(result)
+    function getDocument()
     {
         step({
-            name: "Enable the LayerTree agent",
-            command: "LayerTree.enable",
-            parameters: {},
-            callback: getDocument
-        });
-    };
-    
-    function getDocument(result)
-    {
-        step({
             name: "Get the Document",
             command: "DOM.getDocument",
             parameters: {},
@@ -64,6 +57,16 @@
             name: "Message the page to add a new composited layer",
             command: "Runtime.evaluate",
             parameters: {"_expression_": "addCompositedLayer()"},
+            callback: awaitRequestAnimationFrame
+        });
+    };
+
+    function awaitRequestAnimationFrame(result)
+    {
+        step({
+            name: "Wait for requestAnimationFrame",
+            command: "Runtime.awaitPromise",
+            parameters: {"promiseObjectId": result.result.objectId},
             callback: getModifiedLayerTree
         });
     };
@@ -106,11 +109,7 @@
 
     function finishTest()
     {
-        if (!eventsCount)
-            ProtocolTest.log("FAIL: Did not receive layerTreeDidChange events.");
-        else
-            ProtocolTest.log("\n=== Test complete, all expected conditions met ===");
-
+        ProtocolTest.log("\n=== Test complete, all expected conditions met ===");
         ProtocolTest.completeTest();
     };
 

Modified: trunk/LayoutTests/inspector/timeline/line-column-expected.txt (250871 => 250872)


--- trunk/LayoutTests/inspector/timeline/line-column-expected.txt	2019-10-08 23:01:58 UTC (rev 250871)
+++ trunk/LayoutTests/inspector/timeline/line-column-expected.txt	2019-10-08 23:03:02 UTC (rev 250872)
@@ -12,50 +12,7 @@
   "children": [
     {
       "startTime": "<filtered>",
-      "stackTrace": [
-        {
-          "functionName": "click",
-          "url": "[native code]",
-          "scriptId": "<filtered>",
-          "lineNumber": 0,
-          "columnNumber": 0
-        },
-        {
-          "functionName": "willCallFunctionTest",
-          "url": "timeline/line-column.html",
-          "scriptId": "<filtered>",
-          "lineNumber": 26,
-          "columnNumber": 44
-        },
-        {
-          "functionName": "global code",
-          "url": "",
-          "scriptId": "<filtered>",
-          "lineNumber": 1,
-          "columnNumber": 21
-        },
-        {
-          "functionName": "evaluateWithScopeExtension",
-          "url": "[native code]",
-          "scriptId": "<filtered>",
-          "lineNumber": 0,
-          "columnNumber": 0
-        },
-        {
-          "functionName": "",
-          "url": "",
-          "scriptId": "<filtered>",
-          "lineNumber": 140,
-          "columnNumber": 97
-        }
-      ],
-      "data": {},
       "frameId": "<filtered>",
-      "type": "ScheduleStyleRecalculation"
-    },
-    {
-      "startTime": "<filtered>",
-      "frameId": "<filtered>",
       "data": {
         "type": "click",
         "defaultPrevented": false

Modified: trunk/LayoutTests/inspector/timeline/line-column.html (250871 => 250872)


--- trunk/LayoutTests/inspector/timeline/line-column.html	2019-10-08 23:01:58 UTC (rev 250871)
+++ trunk/LayoutTests/inspector/timeline/line-column.html	2019-10-08 23:03:02 UTC (rev 250872)
@@ -40,7 +40,11 @@
     InspectorProtocol.sendCommand("Page.enable", {});
     InspectorProtocol.sendCommand("Timeline.enable");
 
+    // To avoid flakiness print only events that we always expect.
+    const eventWhitelist = new Set(["RenderingFrame", "ConsoleProfile", "EventDispatch", "FunctionCall"]);
     function replacer(key, value) {
+        if (key === "children" && this.startTime)
+            return value.filter(e => eventWhitelist.has(e.type));
         if (key === "startTime" || key === "endTime" || key === "scriptId" || key === "frameId")
             return "<filtered>";
         if (key === "url" || key === "scriptName")
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to