Changeset 243405 in webkit
- Timestamp:
- Mar 22, 2019, 4:34:29 PM (7 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 16 edited
-
ChangeLog (modified) (1 diff)
-
inspector/timeline/resources/timeline-event-utilities.js (modified) (3 diffs)
-
inspector/timeline/timeline-event-CancelAnimationFrame-expected.txt (modified) (1 diff)
-
inspector/timeline/timeline-event-CancelAnimationFrame.html (modified) (2 diffs)
-
inspector/timeline/timeline-event-EventDispatch-expected.txt (modified) (4 diffs)
-
inspector/timeline/timeline-event-EventDispatch.html (modified) (6 diffs)
-
inspector/timeline/timeline-event-FireAnimationFrame-expected.txt (modified) (1 diff)
-
inspector/timeline/timeline-event-FireAnimationFrame.html (modified) (2 diffs)
-
inspector/timeline/timeline-event-RequestAnimationFrame-expected.txt (modified) (1 diff)
-
inspector/timeline/timeline-event-RequestAnimationFrame.html (modified) (2 diffs)
-
inspector/timeline/timeline-event-TimerFire-expected.txt (modified) (2 diffs)
-
inspector/timeline/timeline-event-TimerFire.html (modified) (4 diffs)
-
inspector/timeline/timeline-event-TimerInstall-expected.txt (modified) (2 diffs)
-
inspector/timeline/timeline-event-TimerInstall.html (modified) (4 diffs)
-
inspector/timeline/timeline-event-TimerRemove-expected.txt (modified) (2 diffs)
-
inspector/timeline/timeline-event-TimerRemove.html (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r243400 r243405 1 2019-03-22 Devin Rousso <drousso@apple.com> 2 3 Unreviewed, fix test failures after r243269. 4 5 In debug builds, it's possible that the Web Inspector frontend is told to stop a timeline 6 recording before all of the recorded records have had a chance to be completed/processed. 7 8 As an example 9 ``` 10 setTimeout(() => { 11 <stop recording> 12 }); 13 ``` 14 it may happen that the "stop recording" event will be dispatched before the timeout has 15 finished executing, meaning that the event that contains the recorded data for that timeout 16 will be ignored by the frontend. 17 18 Rework the tests so that they don't dispatch the "stop recording" event until the expected 19 record is received by the frontend, rather than having the test code itself say when to stop. 20 21 * inspector/timeline/resources/timeline-event-utilities.js: 22 (savePageData): Added. 23 (TestPage.registerInitializer.InspectorTest.TimelineEvent.captureTimelineWithScript): 24 (finishRecording): Deleted. 25 * inspector/timeline/timeline-event-CancelAnimationFrame.html: 26 * inspector/timeline/timeline-event-CancelAnimationFrame-expected.txt: 27 * inspector/timeline/timeline-event-EventDispatch.html: 28 * inspector/timeline/timeline-event-EventDispatch-expected.txt: 29 * inspector/timeline/timeline-event-FireAnimationFrame.html: 30 * inspector/timeline/timeline-event-FireAnimationFrame-expected.txt: 31 * inspector/timeline/timeline-event-RequestAnimationFrame.html: 32 * inspector/timeline/timeline-event-RequestAnimationFrame-expected.txt: 33 * inspector/timeline/timeline-event-TimerFire.html: 34 * inspector/timeline/timeline-event-TimerFire-expected.txt: 35 * inspector/timeline/timeline-event-TimerInstall.html: 36 * inspector/timeline/timeline-event-TimerInstall-expected.txt: 37 * inspector/timeline/timeline-event-TimerRemove.html: 38 * inspector/timeline/timeline-event-TimerRemove-expected.txt: 39 1 40 2019-03-22 Devin Rousso <drousso@apple.com> 2 41 -
trunk/LayoutTests/inspector/timeline/resources/timeline-event-utilities.js
r243269 r243405 1 function finishRecording(data) { 2 TestPage.addResult("Finish recording..."); 3 TestPage.dispatchEventToFrontend("FinishRecording", data); 1 function savePageData(data) { 2 TestPage.dispatchEventToFrontend("SavePageData", data); 4 3 } 5 4 … … 7 6 InspectorTest.TimelineEvent = {}; 8 7 9 InspectorTest.TimelineEvent.captureTimelineWithScript = function( expression) {8 InspectorTest.TimelineEvent.captureTimelineWithScript = function({expression, eventType}) { 10 9 let pageRecordingData = null; 10 11 let promise = new WI.WrappedPromise; 12 13 WI.timelineManager.awaitEvent(WI.TimelineManager.Event.CapturingStopped).then((capturingStoppedEvent) => { 14 InspectorTest.assert(pageRecordingData, "savePageData should have been called in the page before capturing was stopped."); 15 promise.resolve(pageRecordingData); 16 }); 17 18 InspectorTest.awaitEvent("SavePageData").then((event) => { 19 pageRecordingData = event.data; 20 }); 21 22 WI.timelineManager.awaitEvent(WI.TimelineManager.Event.CapturingStarted).then((capturingStartedEvent) => { 23 let recording = WI.timelineManager.activeRecording; 24 let scriptTimeline = recording.timelines.get(WI.TimelineRecord.Type.Script); 25 26 let recordAddedListener = scriptTimeline.addEventListener(WI.Timeline.Event.RecordAdded, (recordAddedEvent) => { 27 let {record} = recordAddedEvent.data; 28 if (record.eventType !== eventType) 29 return; 30 31 scriptTimeline.removeEventListener(WI.Timeline.Event.RecordAdded, recordAddedListener); 32 33 InspectorTest.log("Stopping Capture..."); 34 WI.timelineManager.stopCapturing(); 35 }); 36 37 InspectorTest.log("Evaluating..."); 38 return InspectorTest.evaluateInPage(expression); 39 }); 11 40 12 41 InspectorTest.log("Starting Capture..."); … … 14 43 WI.timelineManager.startCapturing(newRecording); 15 44 16 let promises = []; 17 18 promises.push(WI.timelineManager.awaitEvent(WI.TimelineManager.Event.CapturingStopped)); 19 20 promises.push(InspectorTest.awaitEvent("FinishRecording").then((event) => { 21 InspectorTest.log("Stopping Capture..."); 22 pageRecordingData = event.data; 23 WI.timelineManager.stopCapturing(); 24 })); 25 26 InspectorTest.log("Evaluating..."); 27 promises.push(InspectorTest.evaluateInPage(expression)); 28 29 return Promise.all(promises).then(() => pageRecordingData); 45 return promise.promise; 30 46 } 31 47 }); -
trunk/LayoutTests/inspector/timeline/timeline-event-CancelAnimationFrame-expected.txt
r243269 r243405 6 6 Starting Capture... 7 7 Evaluating... 8 Finish recording...9 8 Stopping Capture... 10 9 PASS: Should be 1 AnimationFrameCanceled record. -
trunk/LayoutTests/inspector/timeline/timeline-event-CancelAnimationFrame.html
r243269 r243405 11 11 }); 12 12 13 savePageData({requestAnimationFrameIdentifier}); 14 13 15 cancelAnimationFrame(requestAnimationFrameIdentifier); 14 15 setTimeout(() => {16 finishRecording({requestAnimationFrameIdentifier});17 });18 16 } 19 17 … … 25 23 name: "TimelineEvent.CancelAnimationFrame.requestAnimationFrame", 26 24 async test() { 27 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testRequestAnimationFrame()`); 25 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ 26 expression: `testRequestAnimationFrame()`, 27 eventType: WI.ScriptTimelineRecord.EventType.AnimationFrameCanceled, 28 }); 28 29 29 30 InspectorTest.assert(typeof pageRecordingData.requestAnimationFrameIdentifier === "number"); -
trunk/LayoutTests/inspector/timeline/timeline-event-EventDispatch-expected.txt
r243269 r243405 8 8 Evaluating... 9 9 PASS: click handler fired 10 Finish recording...11 10 Stopping Capture... 12 11 PASS: Should be 1 EventDispatched record. … … 18 17 Evaluating... 19 18 PASS: click handler fired, will prevent default 20 Finish recording...21 19 Stopping Capture... 22 20 PASS: Should be 1 EventDispatched record. … … 28 26 Evaluating... 29 27 PASS: b1 onclick attribute handler fired 30 Finish recording...31 28 Stopping Capture... 32 29 PASS: Should be 1 EventDispatched record. … … 38 35 Evaluating... 39 36 PASS: b2 onclick attribute handler fired, will prevent default 40 Finish recording...41 37 Stopping Capture... 42 38 PASS: Should be 1 EventDispatched record. -
trunk/LayoutTests/inspector/timeline/timeline-event-EventDispatch.html
r243269 r243405 7 7 8 8 function testClickEventHandler({preventDefault}) { 9 savePageData({preventDefault}); 10 9 11 let button = document.body.appendChild(document.createElement("button")); 10 12 button.addEventListener("click", (event) => { … … 13 15 if (preventDefault) 14 16 event.preventDefault(); 15 16 setTimeout(() => { 17 finishRecording({preventDefault}); 18 }); 19 }); 17 }, {once: true}); 20 18 button.dispatchEvent(new MouseEvent("click", {bubbles: true, cancelable: true})); 21 19 } 22 20 23 21 function testClickEventAttributeHandler(id, {preventDefault}) { 22 savePageData({preventDefault}); 23 24 24 let button = document.getElementById(id); 25 25 button.dispatchEvent(new MouseEvent("click", {bubbles: true, cancelable: true})); 26 27 setTimeout(() => {28 finishRecording({preventDefault});29 });30 26 } 31 27 … … 37 33 name: "TimelineEvent.EventDispatch.Handler.Regular", 38 34 async test() { 39 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testClickEventHandler({preventDefault: false})`); 35 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ 36 expression: `testClickEventHandler({preventDefault: false})`, 37 eventType: WI.ScriptTimelineRecord.EventType.EventDispatched, 38 }); 40 39 41 40 InspectorTest.assert(typeof pageRecordingData.preventDefault === "boolean"); … … 55 54 name: "TimelineEvent.EventDispatch.Handler.DefaultPrevented", 56 55 async test() { 57 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testClickEventHandler({preventDefault: true})`); 56 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ 57 expression: `testClickEventHandler({preventDefault: true})`, 58 eventType: WI.ScriptTimelineRecord.EventType.EventDispatched, 59 }); 58 60 59 61 InspectorTest.assert(typeof pageRecordingData.preventDefault === "boolean"); … … 73 75 name: "TimelineEvent.EventDispatch.AttributeHandler.Regular", 74 76 async test() { 75 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testClickEventAttributeHandler("b1", {preventDefault: false})`); 77 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ 78 expression: `testClickEventAttributeHandler("b1", {preventDefault: false})`, 79 eventType: WI.ScriptTimelineRecord.EventType.EventDispatched, 80 }); 76 81 77 82 InspectorTest.assert(typeof pageRecordingData.preventDefault === "boolean"); … … 91 96 name: "TimelineEvent.EventDispatch.AttributeHandler.DefaultPrevented", 92 97 async test() { 93 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testClickEventAttributeHandler("b2", {preventDefault: true})`); 98 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ 99 expression: `testClickEventAttributeHandler("b2", {preventDefault: true})`, 100 eventType: WI.ScriptTimelineRecord.EventType.EventDispatched, 101 }); 94 102 95 103 InspectorTest.assert(typeof pageRecordingData.preventDefault === "boolean"); -
trunk/LayoutTests/inspector/timeline/timeline-event-FireAnimationFrame-expected.txt
r243269 r243405 7 7 Evaluating... 8 8 PASS: requestAnimationFrame fired 9 Finish recording...10 9 Stopping Capture... 11 10 PASS: Should be 1 AnimationFrameFired record. -
trunk/LayoutTests/inspector/timeline/timeline-event-FireAnimationFrame.html
r243269 r243405 9 9 let requestAnimationFrameIdentifier = requestAnimationFrame(() => { 10 10 TestPage.addResult("PASS: requestAnimationFrame fired"); 11 }); 11 12 12 setTimeout(() => { 13 finishRecording({requestAnimationFrameIdentifier}); 14 }); 15 }); 13 savePageData({requestAnimationFrameIdentifier}); 16 14 } 17 15 … … 23 21 name: "TimelineEvent.FireAnimationFrame.requestAnimationFrame", 24 22 async test() { 25 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testRequestAnimationFrame()`); 23 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ 24 expression: `testRequestAnimationFrame()`, 25 eventType: WI.ScriptTimelineRecord.EventType.AnimationFrameFired, 26 }); 26 27 27 28 InspectorTest.assert(typeof pageRecordingData.requestAnimationFrameIdentifier === "number"); -
trunk/LayoutTests/inspector/timeline/timeline-event-RequestAnimationFrame-expected.txt
r243269 r243405 7 7 Evaluating... 8 8 PASS: requestAnimationFrame fired 9 Finish recording...10 9 Stopping Capture... 11 10 PASS: Should be 1 AnimationFrameRequested record. -
trunk/LayoutTests/inspector/timeline/timeline-event-RequestAnimationFrame.html
r243269 r243405 9 9 let requestAnimationFrameIdentifier = requestAnimationFrame(() => { 10 10 TestPage.addResult("PASS: requestAnimationFrame fired"); 11 }); 11 12 12 setTimeout(() => { 13 finishRecording({requestAnimationFrameIdentifier}); 14 }); 15 }); 13 savePageData({requestAnimationFrameIdentifier}); 16 14 } 17 15 … … 23 21 name: "TimelineEvent.RequestAnimationFrame.requestAnimationFrame", 24 22 async test() { 25 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testRequestAnimationFrame()`); 23 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ 24 expression: `testRequestAnimationFrame()`, 25 eventType: WI.ScriptTimelineRecord.EventType.AnimationFrameFired, 26 }); 26 27 27 28 InspectorTest.assert(typeof pageRecordingData.requestAnimationFrameIdentifier === "number"); -
trunk/LayoutTests/inspector/timeline/timeline-event-TimerFire-expected.txt
r243269 r243405 7 7 Evaluating... 8 8 PASS: setTimeout fired 9 Finish recording...10 9 Stopping Capture... 11 10 PASS: Should be 1 TimerFired record. … … 19 18 PASS: setInterval fired: 2 20 19 PASS: setInterval fired: 3 21 Finish recording...22 20 Stopping Capture... 23 21 PASS: Should be 3 TimerFired records. -
trunk/LayoutTests/inspector/timeline/timeline-event-TimerFire.html
r243269 r243405 9 9 let setTimeoutIdentifier = setTimeout(() => { 10 10 TestPage.addResult("PASS: setTimeout fired"); 11 }, 10); 11 12 12 requestAnimationFrame(() => { 13 finishRecording({setTimeoutIdentifier}); 14 }); 15 }); 13 savePageData({setTimeoutIdentifier}); 16 14 } 17 15 … … 24 22 TestPage.addResult("PASS: setInterval fired: " + count); 25 23 26 if (count === 3) {24 if (count === 3) 27 25 clearInterval(setIntervalIdentifier); 26 }, 5); 28 27 29 requestAnimationFrame(() => { 30 finishRecording({setIntervalIdentifier}); 31 }); 32 } 33 }); 28 savePageData({setIntervalIdentifier}); 34 29 } 35 30 … … 44 39 name: "TimelineEvent.TimerFire.setTimeout", 45 40 async test() { 46 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testSetTimeout()`); 41 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ 42 expression: `testSetTimeout()`, 43 eventType: WI.ScriptTimelineRecord.EventType.TimerFired, 44 }); 47 45 48 46 InspectorTest.assert(typeof pageRecordingData.setTimeoutIdentifier === "number"); … … 63 61 name: "TimelineEvent.TimerFire.setInterval", 64 62 async test() { 65 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testSetInterval()`); 63 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ 64 expression: `testSetInterval()`, 65 eventType: WI.ScriptTimelineRecord.EventType.TimerRemoved, 66 }); 66 67 67 68 InspectorTest.assert(typeof pageRecordingData.setIntervalIdentifier === "number"); -
trunk/LayoutTests/inspector/timeline/timeline-event-TimerInstall-expected.txt
r243269 r243405 7 7 Evaluating... 8 8 PASS: setTimeout fired 9 Finish recording...10 9 Stopping Capture... 11 10 PASS: Should be 1 TimerInstalled record. … … 19 18 PASS: setInterval fired: 2 20 19 PASS: setInterval fired: 3 21 Finish recording...22 20 Stopping Capture... 23 21 PASS: Should be 1 TimerInstalled record. -
trunk/LayoutTests/inspector/timeline/timeline-event-TimerInstall.html
r243269 r243405 9 9 let setTimeoutIdentifier = setTimeout(() => { 10 10 TestPage.addResult("PASS: setTimeout fired"); 11 }, 10); 11 12 12 requestAnimationFrame(() => { 13 finishRecording({setTimeoutIdentifier}); 14 }); 15 }, 10); 13 savePageData({setTimeoutIdentifier}); 16 14 } 17 15 … … 24 22 TestPage.addResult("PASS: setInterval fired: " + count); 25 23 26 if (count === 3) {24 if (count === 3) 27 25 clearInterval(setIntervalIdentifier); 26 }, 5); 28 27 29 requestAnimationFrame(() => { 30 finishRecording({setIntervalIdentifier}); 31 }); 32 } 33 }, 5); 28 savePageData({setIntervalIdentifier}); 34 29 } 35 30 … … 50 45 name: "TimelineEvent.TimerInstall.setTimeout", 51 46 async test() { 52 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testSetTimeout()`); 47 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ 48 expression: `testSetTimeout()`, 49 eventType: WI.ScriptTimelineRecord.EventType.TimerFired, 50 }); 53 51 54 52 InspectorTest.assert(typeof pageRecordingData.setTimeoutIdentifier === "number"); … … 69 67 name: "TimelineEvent.TimerInstall.setInterval", 70 68 async test() { 71 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testSetInterval()`); 69 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ 70 expression: `testSetInterval()`, 71 eventType: WI.ScriptTimelineRecord.EventType.TimerRemoved, 72 }); 72 73 73 74 InspectorTest.assert(typeof pageRecordingData.setIntervalIdentifier === "number"); -
trunk/LayoutTests/inspector/timeline/timeline-event-TimerRemove-expected.txt
r243269 r243405 6 6 Starting Capture... 7 7 Evaluating... 8 Finish recording...9 8 Stopping Capture... 10 9 PASS: Should be 1 TimerRemoved record. … … 18 17 PASS: setInterval fired: 2 19 18 PASS: setInterval fired: 3 20 Finish recording...21 19 Stopping Capture... 22 20 PASS: Should be 1 TimerRemoved record. -
trunk/LayoutTests/inspector/timeline/timeline-event-TimerRemove.html
r243269 r243405 9 9 let setTimeoutIdentifier = setTimeout(() => { 10 10 TestPage.addResult("FAIL: setTimeout fired"); 11 }); 11 }, 10); 12 13 savePageData({setTimeoutIdentifier}); 12 14 13 15 clearTimeout(setTimeoutIdentifier); 14 15 requestAnimationFrame(() => {16 finishRecording({setTimeoutIdentifier});17 });18 16 } 19 17 … … 26 24 TestPage.addResult("PASS: setInterval fired: " + count); 27 25 28 if (count === 3) {26 if (count === 3) 29 27 clearInterval(setIntervalIdentifier); 28 }, 5); 30 29 31 requestAnimationFrame(() => { 32 finishRecording({setIntervalIdentifier}); 33 }); 34 } 35 }); 30 savePageData({setIntervalIdentifier}); 36 31 } 37 32 … … 46 41 name: "TimelineEvent.TimerRemove.setTimeout", 47 42 async test() { 48 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testSetTimeout()`); 43 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ 44 expression: `testSetTimeout()`, 45 eventType: WI.ScriptTimelineRecord.EventType.TimerRemoved, 46 }); 49 47 50 48 InspectorTest.assert(typeof pageRecordingData.setTimeoutIdentifier === "number"); … … 65 63 name: "TimelineEvent.TimerRemove.setInterval", 66 64 async test() { 67 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript(`testSetInterval()`); 65 let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ 66 expression: `testSetInterval()`, 67 eventType: WI.ScriptTimelineRecord.EventType.TimerRemoved, 68 }); 68 69 69 70 InspectorTest.assert(typeof pageRecordingData.setIntervalIdentifier === "number");
Note:
See TracChangeset
for help on using the changeset viewer.