| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/timeline-test.js"></script> | 4 <script src="../../../http/tests/inspector/timeline-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 function performActions(callback) | 6 function performActions() |
| 7 { | 7 { |
| 8 var callback; |
| 9 var promise = new Promise((fulfill) => callback = fulfill); |
| 8 var requestId = window.requestAnimationFrame(animationFrameCallback); | 10 var requestId = window.requestAnimationFrame(animationFrameCallback); |
| 9 function animationFrameCallback() | 11 function animationFrameCallback() |
| 10 { | 12 { |
| 11 window.cancelAnimationFrame(requestId); | 13 window.cancelAnimationFrame(requestId); |
| 12 if (callback) | 14 if (callback) |
| 13 callback(); | 15 callback(); |
| 14 } | 16 } |
| 17 return promise; |
| 15 } | 18 } |
| 16 | 19 |
| 17 function test() | 20 function test() |
| 18 { | 21 { |
| 19 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | 22 InspectorTest.invokeAsyncWithTimeline("performActions", finish); |
| 20 | 23 |
| 21 function finish() | 24 function finish() |
| 22 { | 25 { |
| 23 InspectorTest.printTimelineRecordsWithDetails("RequestAnimationFrame"); | 26 InspectorTest.printTimelineRecordsWithDetails("RequestAnimationFrame"); |
| 24 InspectorTest.printTimelineRecordsWithDetails("FireAnimationFrame"); | 27 InspectorTest.printTimelineRecordsWithDetails("FireAnimationFrame"); |
| 25 InspectorTest.printTimelineRecordsWithDetails("CancelAnimationFrame"); | 28 InspectorTest.printTimelineRecordsWithDetails("CancelAnimationFrame"); |
| 26 InspectorTest.completeTest(); | 29 InspectorTest.completeTest(); |
| 27 } | 30 } |
| 28 } | 31 } |
| 29 | 32 |
| 30 if (!window.testRunner) | 33 if (!window.testRunner) |
| 31 setTimeout(performActions, 2000); | 34 setTimeout(performActions, 2000); |
| 32 </script> | 35 </script> |
| 33 </head> | 36 </head> |
| 34 | 37 |
| 35 <body onload="runTest()"> | 38 <body onload="runTest()"> |
| 36 <p> | 39 <p> |
| 37 Tests the Timeline events for Animation Frame feature | 40 Tests the Timeline events for Animation Frame feature |
| 38 </p> | 41 </p> |
| 39 </body> | 42 </body> |
| 40 </html> | 43 </html> |
| OLD | NEW |