Title: [243405] trunk/LayoutTests
Revision
243405
Author
[email protected]
Date
2019-03-22 16:34:29 -0700 (Fri, 22 Mar 2019)

Log Message

Unreviewed, fix test failures after r243269.

In debug builds, it's possible that the Web Inspector frontend is told to stop a timeline
recording before all of the recorded records have had a chance to be completed/processed.

As an example
```
    setTimeout(() => {
        <stop recording>
    });
```
it may happen that the "stop recording" event will be dispatched before the timeout has
finished executing, meaning that the event that contains the recorded data for that timeout
will be ignored by the frontend.

Rework the tests so that they don't dispatch the "stop recording" event until the expected
record is received by the frontend, rather than having the test code itself say when to stop.

* inspector/timeline/resources/timeline-event-utilities.js:
(savePageData): Added.
(TestPage.registerInitializer.InspectorTest.TimelineEvent.captureTimelineWithScript):
(finishRecording): Deleted.
* inspector/timeline/timeline-event-CancelAnimationFrame.html:
* inspector/timeline/timeline-event-CancelAnimationFrame-expected.txt:
* inspector/timeline/timeline-event-EventDispatch.html:
* inspector/timeline/timeline-event-EventDispatch-expected.txt:
* inspector/timeline/timeline-event-FireAnimationFrame.html:
* inspector/timeline/timeline-event-FireAnimationFrame-expected.txt:
* inspector/timeline/timeline-event-RequestAnimationFrame.html:
* inspector/timeline/timeline-event-RequestAnimationFrame-expected.txt:
* inspector/timeline/timeline-event-TimerFire.html:
* inspector/timeline/timeline-event-TimerFire-expected.txt:
* inspector/timeline/timeline-event-TimerInstall.html:
* inspector/timeline/timeline-event-TimerInstall-expected.txt:
* inspector/timeline/timeline-event-TimerRemove.html:
* inspector/timeline/timeline-event-TimerRemove-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (243404 => 243405)


--- trunk/LayoutTests/ChangeLog	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/ChangeLog	2019-03-22 23:34:29 UTC (rev 243405)
@@ -1,5 +1,44 @@
 2019-03-22  Devin Rousso  <[email protected]>
 
+        Unreviewed, fix test failures after r243269.
+
+        In debug builds, it's possible that the Web Inspector frontend is told to stop a timeline
+        recording before all of the recorded records have had a chance to be completed/processed.
+
+        As an example
+        ```
+            setTimeout(() => {
+                <stop recording>
+            });
+        ```
+        it may happen that the "stop recording" event will be dispatched before the timeout has
+        finished executing, meaning that the event that contains the recorded data for that timeout
+        will be ignored by the frontend.
+
+        Rework the tests so that they don't dispatch the "stop recording" event until the expected
+        record is received by the frontend, rather than having the test code itself say when to stop.
+
+        * inspector/timeline/resources/timeline-event-utilities.js:
+        (savePageData): Added.
+        (TestPage.registerInitializer.InspectorTest.TimelineEvent.captureTimelineWithScript):
+        (finishRecording): Deleted.
+        * inspector/timeline/timeline-event-CancelAnimationFrame.html:
+        * inspector/timeline/timeline-event-CancelAnimationFrame-expected.txt:
+        * inspector/timeline/timeline-event-EventDispatch.html:
+        * inspector/timeline/timeline-event-EventDispatch-expected.txt:
+        * inspector/timeline/timeline-event-FireAnimationFrame.html:
+        * inspector/timeline/timeline-event-FireAnimationFrame-expected.txt:
+        * inspector/timeline/timeline-event-RequestAnimationFrame.html:
+        * inspector/timeline/timeline-event-RequestAnimationFrame-expected.txt:
+        * inspector/timeline/timeline-event-TimerFire.html:
+        * inspector/timeline/timeline-event-TimerFire-expected.txt:
+        * inspector/timeline/timeline-event-TimerInstall.html:
+        * inspector/timeline/timeline-event-TimerInstall-expected.txt:
+        * inspector/timeline/timeline-event-TimerRemove.html:
+        * inspector/timeline/timeline-event-TimerRemove-expected.txt:
+
+2019-03-22  Devin Rousso  <[email protected]>
+
         Web Inspector: Safari Canvas Inspector seems to show the canvas being rendered twice per frame.
         https://bugs.webkit.org/show_bug.cgi?id=196082
         <rdar://problem/49113496>

Modified: trunk/LayoutTests/inspector/timeline/resources/timeline-event-utilities.js (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/resources/timeline-event-utilities.js	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/resources/timeline-event-utilities.js	2019-03-22 23:34:29 UTC (rev 243405)
@@ -1,31 +1,47 @@
-function finishRecording(data) {
-    TestPage.addResult("Finish recording...");
-    TestPage.dispatchEventToFrontend("FinishRecording", data);
+function savePageData(data) {
+    TestPage.dispatchEventToFrontend("SavePageData", data);
 }
 
 TestPage.registerInitializer(() => {
     InspectorTest.TimelineEvent = {};
 
-    InspectorTest.TimelineEvent.captureTimelineWithScript = function(_expression_) {
+    InspectorTest.TimelineEvent.captureTimelineWithScript = function({_expression_, eventType}) {
         let pageRecordingData = null;
 
-        InspectorTest.log("Starting Capture...");
-        const newRecording = true;
-        WI.timelineManager.startCapturing(newRecording);
+        let promise = new WI.WrappedPromise;
 
-        let promises = [];
+        WI.timelineManager.awaitEvent(WI.TimelineManager.Event.CapturingStopped).then((capturingStoppedEvent) => {
+            InspectorTest.assert(pageRecordingData, "savePageData should have been called in the page before capturing was stopped.");
+            promise.resolve(pageRecordingData);
+        });
 
-        promises.push(WI.timelineManager.awaitEvent(WI.TimelineManager.Event.CapturingStopped));
-
-        promises.push(InspectorTest.awaitEvent("FinishRecording").then((event) => {
-            InspectorTest.log("Stopping Capture...");
+        InspectorTest.awaitEvent("SavePageData").then((event) => {
             pageRecordingData = event.data;
-            WI.timelineManager.stopCapturing();
-        }));
+        });
 
-        InspectorTest.log("Evaluating...");
-        promises.push(InspectorTest.evaluateInPage(_expression_));
+        WI.timelineManager.awaitEvent(WI.TimelineManager.Event.CapturingStarted).then((capturingStartedEvent) => {
+            let recording = WI.timelineManager.activeRecording;
+            let scriptTimeline = recording.timelines.get(WI.TimelineRecord.Type.Script);
 
-        return Promise.all(promises).then(() => pageRecordingData);
+            let recordAddedListener = scriptTimeline.addEventListener(WI.Timeline.Event.RecordAdded, (recordAddedEvent) => {
+                let {record} = recordAddedEvent.data;
+                if (record.eventType !== eventType)
+                    return;
+
+                scriptTimeline.removeEventListener(WI.Timeline.Event.RecordAdded, recordAddedListener);
+
+                InspectorTest.log("Stopping Capture...");
+                WI.timelineManager.stopCapturing();
+            });
+
+            InspectorTest.log("Evaluating...");
+            return InspectorTest.evaluateInPage(_expression_);
+        });
+
+        InspectorTest.log("Starting Capture...");
+        const newRecording = true;
+        WI.timelineManager.startCapturing(newRecording);
+
+        return promise.promise;
     }
 });

Modified: trunk/LayoutTests/inspector/timeline/timeline-event-CancelAnimationFrame-expected.txt (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/timeline-event-CancelAnimationFrame-expected.txt	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/timeline-event-CancelAnimationFrame-expected.txt	2019-03-22 23:34:29 UTC (rev 243405)
@@ -5,7 +5,6 @@
 -- Running test case: TimelineEvent.CancelAnimationFrame.requestAnimationFrame
 Starting Capture...
 Evaluating...
-Finish recording...
 Stopping Capture...
 PASS: Should be 1 AnimationFrameCanceled record.
 DETAILS: number

Modified: trunk/LayoutTests/inspector/timeline/timeline-event-CancelAnimationFrame.html (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/timeline-event-CancelAnimationFrame.html	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/timeline-event-CancelAnimationFrame.html	2019-03-22 23:34:29 UTC (rev 243405)
@@ -10,11 +10,9 @@
         TestPage.addResult("FAIL: requestAnimationFrame fired");
     });
 
+    savePageData({requestAnimationFrameIdentifier});
+
     cancelAnimationFrame(requestAnimationFrameIdentifier);
-
-    setTimeout(() => {
-        finishRecording({requestAnimationFrameIdentifier});
-    });
 }
 
 function test()
@@ -24,7 +22,10 @@
     suite.addTestCase({
         name: "TimelineEvent.CancelAnimationFrame.requestAnimationFrame",
         async test() {
-            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testRequestAnimationFrame()`);
+            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({
+                _expression_: `testRequestAnimationFrame()`,
+                eventType: WI.ScriptTimelineRecord.EventType.AnimationFrameCanceled,
+            });
 
             InspectorTest.assert(typeof pageRecordingData.requestAnimationFrameIdentifier === "number");
 

Modified: trunk/LayoutTests/inspector/timeline/timeline-event-EventDispatch-expected.txt (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/timeline-event-EventDispatch-expected.txt	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/timeline-event-EventDispatch-expected.txt	2019-03-22 23:34:29 UTC (rev 243405)
@@ -7,7 +7,6 @@
 Starting Capture...
 Evaluating...
 PASS: click handler fired
-Finish recording...
 Stopping Capture...
 PASS: Should be 1 EventDispatched record.
 DETAILS: {"type":"click","defaultPrevented":false}
@@ -17,7 +16,6 @@
 Starting Capture...
 Evaluating...
 PASS: click handler fired, will prevent default
-Finish recording...
 Stopping Capture...
 PASS: Should be 1 EventDispatched record.
 DETAILS: {"type":"click","defaultPrevented":true}
@@ -27,7 +25,6 @@
 Starting Capture...
 Evaluating...
 PASS: b1 onclick attribute handler fired
-Finish recording...
 Stopping Capture...
 PASS: Should be 1 EventDispatched record.
 DETAILS: {"type":"click","defaultPrevented":false}
@@ -37,7 +34,6 @@
 Starting Capture...
 Evaluating...
 PASS: b2 onclick attribute handler fired, will prevent default
-Finish recording...
 Stopping Capture...
 PASS: Should be 1 EventDispatched record.
 DETAILS: {"type":"click","defaultPrevented":true}

Modified: trunk/LayoutTests/inspector/timeline/timeline-event-EventDispatch.html (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/timeline-event-EventDispatch.html	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/timeline-event-EventDispatch.html	2019-03-22 23:34:29 UTC (rev 243405)
@@ -6,6 +6,8 @@
 <script>
 
 function testClickEventHandler({preventDefault}) {
+    savePageData({preventDefault});
+
     let button = document.body.appendChild(document.createElement("button"));
     button.addEventListener("click", (event) => {
         TestPage.addResult("PASS: click handler fired" + (preventDefault ? ", will prevent default" : ""));
@@ -12,21 +14,15 @@
 
         if (preventDefault)
             event.preventDefault();
-
-        setTimeout(() => {
-            finishRecording({preventDefault});
-        });
-    });
+    }, {once: true});
     button.dispatchEvent(new MouseEvent("click", {bubbles: true, cancelable: true}));
 }
 
 function testClickEventAttributeHandler(id, {preventDefault}) {
+    savePageData({preventDefault});
+
     let button = document.getElementById(id);
     button.dispatchEvent(new MouseEvent("click", {bubbles: true, cancelable: true}));
-
-    setTimeout(() => {
-        finishRecording({preventDefault});
-    });
 }
 
 function test()
@@ -36,7 +32,10 @@
     suite.addTestCase({
         name: "TimelineEvent.EventDispatch.Handler.Regular",
         async test() {
-            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testClickEventHandler({preventDefault: false})`);
+            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({
+                _expression_: `testClickEventHandler({preventDefault: false})`,
+                eventType: WI.ScriptTimelineRecord.EventType.EventDispatched,
+            });
 
             InspectorTest.assert(typeof pageRecordingData.preventDefault === "boolean");
 
@@ -54,7 +53,10 @@
     suite.addTestCase({
         name: "TimelineEvent.EventDispatch.Handler.DefaultPrevented",
         async test() {
-            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testClickEventHandler({preventDefault: true})`);
+            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({
+                _expression_: `testClickEventHandler({preventDefault: true})`,
+                eventType: WI.ScriptTimelineRecord.EventType.EventDispatched,
+            });
 
             InspectorTest.assert(typeof pageRecordingData.preventDefault === "boolean");
 
@@ -72,7 +74,10 @@
     suite.addTestCase({
         name: "TimelineEvent.EventDispatch.AttributeHandler.Regular",
         async test() {
-            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testClickEventAttributeHandler("b1", {preventDefault: false})`);
+            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({
+                _expression_: `testClickEventAttributeHandler("b1", {preventDefault: false})`,
+                eventType: WI.ScriptTimelineRecord.EventType.EventDispatched,
+            });
 
             InspectorTest.assert(typeof pageRecordingData.preventDefault === "boolean");
 
@@ -90,7 +95,10 @@
     suite.addTestCase({
         name: "TimelineEvent.EventDispatch.AttributeHandler.DefaultPrevented",
         async test() {
-            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testClickEventAttributeHandler("b2", {preventDefault: true})`);
+            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({
+                _expression_: `testClickEventAttributeHandler("b2", {preventDefault: true})`,
+                eventType: WI.ScriptTimelineRecord.EventType.EventDispatched,
+            });
 
             InspectorTest.assert(typeof pageRecordingData.preventDefault === "boolean");
 

Modified: trunk/LayoutTests/inspector/timeline/timeline-event-FireAnimationFrame-expected.txt (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/timeline-event-FireAnimationFrame-expected.txt	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/timeline-event-FireAnimationFrame-expected.txt	2019-03-22 23:34:29 UTC (rev 243405)
@@ -6,7 +6,6 @@
 Starting Capture...
 Evaluating...
 PASS: requestAnimationFrame fired
-Finish recording...
 Stopping Capture...
 PASS: Should be 1 AnimationFrameFired record.
 DETAILS: number

Modified: trunk/LayoutTests/inspector/timeline/timeline-event-FireAnimationFrame.html (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/timeline-event-FireAnimationFrame.html	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/timeline-event-FireAnimationFrame.html	2019-03-22 23:34:29 UTC (rev 243405)
@@ -8,11 +8,9 @@
 function testRequestAnimationFrame() {
     let requestAnimationFrameIdentifier = requestAnimationFrame(() => {
         TestPage.addResult("PASS: requestAnimationFrame fired");
+    });
 
-        setTimeout(() => {
-            finishRecording({requestAnimationFrameIdentifier});
-        });
-    });
+    savePageData({requestAnimationFrameIdentifier});
 }
 
 function test()
@@ -22,7 +20,10 @@
     suite.addTestCase({
         name: "TimelineEvent.FireAnimationFrame.requestAnimationFrame",
         async test() {
-            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testRequestAnimationFrame()`);
+            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({
+                _expression_: `testRequestAnimationFrame()`,
+                eventType: WI.ScriptTimelineRecord.EventType.AnimationFrameFired,
+            });
 
             InspectorTest.assert(typeof pageRecordingData.requestAnimationFrameIdentifier === "number");
 

Modified: trunk/LayoutTests/inspector/timeline/timeline-event-RequestAnimationFrame-expected.txt (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/timeline-event-RequestAnimationFrame-expected.txt	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/timeline-event-RequestAnimationFrame-expected.txt	2019-03-22 23:34:29 UTC (rev 243405)
@@ -6,7 +6,6 @@
 Starting Capture...
 Evaluating...
 PASS: requestAnimationFrame fired
-Finish recording...
 Stopping Capture...
 PASS: Should be 1 AnimationFrameRequested record.
 DETAILS: number

Modified: trunk/LayoutTests/inspector/timeline/timeline-event-RequestAnimationFrame.html (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/timeline-event-RequestAnimationFrame.html	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/timeline-event-RequestAnimationFrame.html	2019-03-22 23:34:29 UTC (rev 243405)
@@ -8,11 +8,9 @@
 function testRequestAnimationFrame() {
     let requestAnimationFrameIdentifier = requestAnimationFrame(() => {
         TestPage.addResult("PASS: requestAnimationFrame fired");
+    });
 
-        setTimeout(() => {
-            finishRecording({requestAnimationFrameIdentifier});
-        });
-    });
+    savePageData({requestAnimationFrameIdentifier});
 }
 
 function test()
@@ -22,7 +20,10 @@
     suite.addTestCase({
         name: "TimelineEvent.RequestAnimationFrame.requestAnimationFrame",
         async test() {
-            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testRequestAnimationFrame()`);
+            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({
+                _expression_: `testRequestAnimationFrame()`,
+                eventType: WI.ScriptTimelineRecord.EventType.AnimationFrameFired,
+            });
 
             InspectorTest.assert(typeof pageRecordingData.requestAnimationFrameIdentifier === "number");
 

Modified: trunk/LayoutTests/inspector/timeline/timeline-event-TimerFire-expected.txt (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/timeline-event-TimerFire-expected.txt	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/timeline-event-TimerFire-expected.txt	2019-03-22 23:34:29 UTC (rev 243405)
@@ -6,7 +6,6 @@
 Starting Capture...
 Evaluating...
 PASS: setTimeout fired
-Finish recording...
 Stopping Capture...
 PASS: Should be 1 TimerFired record.
 DETAILS: number
@@ -18,7 +17,6 @@
 PASS: setInterval fired: 1
 PASS: setInterval fired: 2
 PASS: setInterval fired: 3
-Finish recording...
 Stopping Capture...
 PASS: Should be 3 TimerFired records.
 DETAILS: number

Modified: trunk/LayoutTests/inspector/timeline/timeline-event-TimerFire.html (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/timeline-event-TimerFire.html	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/timeline-event-TimerFire.html	2019-03-22 23:34:29 UTC (rev 243405)
@@ -8,11 +8,9 @@
 function testSetTimeout() {
     let setTimeoutIdentifier = setTimeout(() => {
         TestPage.addResult("PASS: setTimeout fired");
+    }, 10);
 
-        requestAnimationFrame(() => {
-            finishRecording({setTimeoutIdentifier});
-        });
-    });
+    savePageData({setTimeoutIdentifier});
 }
 
 function testSetInterval() {
@@ -23,14 +21,11 @@
 
         TestPage.addResult("PASS: setInterval fired: " + count);
 
-        if (count === 3) {
+        if (count === 3)
             clearInterval(setIntervalIdentifier);
+    }, 5);
 
-            requestAnimationFrame(() => {
-                finishRecording({setIntervalIdentifier});
-            });
-        }
-    });
+    savePageData({setIntervalIdentifier});
 }
 
 function test()
@@ -43,7 +38,10 @@
     suite.addTestCase({
         name: "TimelineEvent.TimerFire.setTimeout",
         async test() {
-            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testSetTimeout()`);
+            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({
+                _expression_: `testSetTimeout()`,
+                eventType: WI.ScriptTimelineRecord.EventType.TimerFired,
+            });
 
             InspectorTest.assert(typeof pageRecordingData.setTimeoutIdentifier === "number");
             timeoutIdentifier = pageRecordingData.setTimeoutIdentifier;
@@ -62,7 +60,10 @@
     suite.addTestCase({
         name: "TimelineEvent.TimerFire.setInterval",
         async test() {
-            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testSetInterval()`);
+            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({
+                _expression_: `testSetInterval()`,
+                eventType: WI.ScriptTimelineRecord.EventType.TimerRemoved,
+            });
 
             InspectorTest.assert(typeof pageRecordingData.setIntervalIdentifier === "number");
             intervalIdentifier = pageRecordingData.setIntervalIdentifier;

Modified: trunk/LayoutTests/inspector/timeline/timeline-event-TimerInstall-expected.txt (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/timeline-event-TimerInstall-expected.txt	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/timeline-event-TimerInstall-expected.txt	2019-03-22 23:34:29 UTC (rev 243405)
@@ -6,7 +6,6 @@
 Starting Capture...
 Evaluating...
 PASS: setTimeout fired
-Finish recording...
 Stopping Capture...
 PASS: Should be 1 TimerInstalled record.
 DETAILS: {"timerId":"<filtered>","timeout":10,"repeating":false}
@@ -18,7 +17,6 @@
 PASS: setInterval fired: 1
 PASS: setInterval fired: 2
 PASS: setInterval fired: 3
-Finish recording...
 Stopping Capture...
 PASS: Should be 1 TimerInstalled record.
 DETAILS: {"timerId":"<filtered>","timeout":5,"repeating":true}

Modified: trunk/LayoutTests/inspector/timeline/timeline-event-TimerInstall.html (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/timeline-event-TimerInstall.html	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/timeline-event-TimerInstall.html	2019-03-22 23:34:29 UTC (rev 243405)
@@ -8,11 +8,9 @@
 function testSetTimeout() {
     let setTimeoutIdentifier = setTimeout(() => {
         TestPage.addResult("PASS: setTimeout fired");
+    }, 10);
 
-        requestAnimationFrame(() => {
-            finishRecording({setTimeoutIdentifier});
-        });
-    }, 10);
+    savePageData({setTimeoutIdentifier});
 }
 
 function testSetInterval() {
@@ -23,14 +21,11 @@
 
         TestPage.addResult("PASS: setInterval fired: " + count);
 
-        if (count === 3) {
+        if (count === 3)
             clearInterval(setIntervalIdentifier);
+    }, 5);
 
-            requestAnimationFrame(() => {
-                finishRecording({setIntervalIdentifier});
-            });
-        }
-    }, 5);
+    savePageData({setIntervalIdentifier});
 }
 
 function test()
@@ -49,7 +44,10 @@
     suite.addTestCase({
         name: "TimelineEvent.TimerInstall.setTimeout",
         async test() {
-            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testSetTimeout()`);
+            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({
+                _expression_: `testSetTimeout()`,
+                eventType: WI.ScriptTimelineRecord.EventType.TimerFired,
+            });
 
             InspectorTest.assert(typeof pageRecordingData.setTimeoutIdentifier === "number");
             timeoutIdentifier = pageRecordingData.setTimeoutIdentifier;
@@ -68,7 +66,10 @@
     suite.addTestCase({
         name: "TimelineEvent.TimerInstall.setInterval",
         async test() {
-            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testSetInterval()`);
+            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({
+                _expression_: `testSetInterval()`,
+                eventType: WI.ScriptTimelineRecord.EventType.TimerRemoved,
+            });
 
             InspectorTest.assert(typeof pageRecordingData.setIntervalIdentifier === "number");
             intervalIdentifier = pageRecordingData.setIntervalIdentifier;

Modified: trunk/LayoutTests/inspector/timeline/timeline-event-TimerRemove-expected.txt (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/timeline-event-TimerRemove-expected.txt	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/timeline-event-TimerRemove-expected.txt	2019-03-22 23:34:29 UTC (rev 243405)
@@ -5,7 +5,6 @@
 -- Running test case: TimelineEvent.TimerRemove.setTimeout
 Starting Capture...
 Evaluating...
-Finish recording...
 Stopping Capture...
 PASS: Should be 1 TimerRemoved record.
 DETAILS: number
@@ -17,7 +16,6 @@
 PASS: setInterval fired: 1
 PASS: setInterval fired: 2
 PASS: setInterval fired: 3
-Finish recording...
 Stopping Capture...
 PASS: Should be 1 TimerRemoved record.
 DETAILS: number

Modified: trunk/LayoutTests/inspector/timeline/timeline-event-TimerRemove.html (243404 => 243405)


--- trunk/LayoutTests/inspector/timeline/timeline-event-TimerRemove.html	2019-03-22 22:54:50 UTC (rev 243404)
+++ trunk/LayoutTests/inspector/timeline/timeline-event-TimerRemove.html	2019-03-22 23:34:29 UTC (rev 243405)
@@ -8,13 +8,11 @@
 function testSetTimeout() {
     let setTimeoutIdentifier = setTimeout(() => {
         TestPage.addResult("FAIL: setTimeout fired");
-    });
+    }, 10);
 
+    savePageData({setTimeoutIdentifier});
+
     clearTimeout(setTimeoutIdentifier);
-
-    requestAnimationFrame(() => {
-        finishRecording({setTimeoutIdentifier});
-    });
 }
 
 function testSetInterval() {
@@ -25,14 +23,11 @@
 
         TestPage.addResult("PASS: setInterval fired: " + count);
 
-        if (count === 3) {
+        if (count === 3)
             clearInterval(setIntervalIdentifier);
+    }, 5);
 
-            requestAnimationFrame(() => {
-                finishRecording({setIntervalIdentifier});
-            });
-        }
-    });
+    savePageData({setIntervalIdentifier});
 }
 
 function test()
@@ -45,7 +40,10 @@
     suite.addTestCase({
         name: "TimelineEvent.TimerRemove.setTimeout",
         async test() {
-            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testSetTimeout()`);
+            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({
+                _expression_: `testSetTimeout()`,
+                eventType: WI.ScriptTimelineRecord.EventType.TimerRemoved,
+            });
 
             InspectorTest.assert(typeof pageRecordingData.setTimeoutIdentifier === "number");
             timeoutIdentifier = pageRecordingData.setTimeoutIdentifier;
@@ -64,7 +62,10 @@
     suite.addTestCase({
         name: "TimelineEvent.TimerRemove.setInterval",
         async test() {
-            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testSetInterval()`);
+            let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({
+                _expression_: `testSetInterval()`,
+                eventType: WI.ScriptTimelineRecord.EventType.TimerRemoved,
+            });
 
             InspectorTest.assert(typeof pageRecordingData.setIntervalIdentifier === "number");
             intervalIdentifier = pageRecordingData.setIntervalIdentifier;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to