| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../http/tests/inspector/resources/inspector-test.js"></script> |
| <script src="./resources/timeline-event-utilities.js"></script> |
| <script> |
| |
| function testRequestAnimationFrame() { |
| let requestAnimationFrameIdentifier = requestAnimationFrame(() => { |
| TestPage.addResult("PASS: requestAnimationFrame fired"); |
| }); |
| |
| savePageData({requestAnimationFrameIdentifier}); |
| } |
| |
| function test() |
| { |
| let suite = InspectorTest.createAsyncSuite("TimelineEvent.RequestAnimationFrame"); |
| |
| suite.addTestCase({ |
| name: "TimelineEvent.RequestAnimationFrame.requestAnimationFrame", |
| async test() { |
| let pageRecordingData = await InspectorTest.TimelineEvent.captureTimelineWithScript({ |
| expression: `testRequestAnimationFrame()`, |
| eventType: WI.ScriptTimelineRecord.EventType.AnimationFrameFired, |
| }); |
| |
| InspectorTest.assert(typeof pageRecordingData.requestAnimationFrameIdentifier === "number"); |
| |
| let recording = WI.timelineManager.activeRecording; |
| let scriptTimeline = recording.timelines.get(WI.TimelineRecord.Type.Script); |
| let records = scriptTimeline.records.filter((x) => x.eventType === WI.ScriptTimelineRecord.EventType.AnimationFrameRequested); |
| InspectorTest.expectEqual(records.length, 1, "Should be 1 AnimationFrameRequested record."); |
| for (let record of records) { |
| InspectorTest.log("DETAILS: " + typeof record.details); |
| InspectorTest.expectEqual(record.details, pageRecordingData.requestAnimationFrameIdentifier, "ScriptTimelineRecord details should be the requestAnimationFrame identifier."); |
| } |
| } |
| }); |
| |
| suite.runTestCasesAndFinish(); |
| } |
| |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Tests 'RequestAnimationFrame' Timeline event records.</p> |
| </body> |
| </html> |