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 | 6 |
7 function performActions() | 7 function performActions(callback) |
8 { | 8 { |
9 var element = document.getElementById("animation"); | 9 var element = document.getElementById("animation"); |
10 var requestId = window.requestAnimationFrame(animationFrameCallback, element
); | 10 var requestId = window.requestAnimationFrame(animationFrameCallback, element
); |
11 function animationFrameCallback() | 11 function animationFrameCallback() |
12 { | 12 { |
13 window.cancelAnimationFrame(requestId); | 13 window.cancelAnimationFrame(requestId); |
| 14 callback(); |
14 } | 15 } |
15 } | 16 } |
16 | 17 |
17 function test() | 18 function test() |
18 { | 19 { |
19 InspectorTest.startTimeline(function() { | 20 InspectorTest.invokeAsyncWithTimeline("performActions", finish); |
20 InspectorTest.evaluateInPage("performActions()"); | |
21 }); | |
22 | |
23 InspectorTest.waitForRecordType("CancelAnimationFrame", finish); | |
24 | 21 |
25 function finish() | 22 function finish() |
26 { | 23 { |
27 InspectorTest.printTimelineRecords("RequestAnimationFrame"); | 24 InspectorTest.printTimelineRecords("RequestAnimationFrame"); |
28 InspectorTest.printTimelineRecords("FireAnimationFrame"); | 25 InspectorTest.printTimelineRecords("FireAnimationFrame"); |
29 InspectorTest.printTimelineRecords("CancelAnimationFrame"); | 26 InspectorTest.printTimelineRecords("CancelAnimationFrame"); |
30 InspectorTest.completeTest(); | 27 InspectorTest.completeTest(); |
31 } | 28 } |
32 } | 29 } |
33 | 30 |
34 if (!window.testRunner) | 31 if (!window.testRunner) |
35 setTimeout(performActions, 2000); | 32 setTimeout(performActions, 2000); |
36 | 33 |
37 </script> | 34 </script> |
38 </head> | 35 </head> |
39 | 36 |
40 <body onload="runTest()"> | 37 <body onload="runTest()"> |
41 <p> | 38 <p> |
42 Tests the Timeline events for Animation Frame feature | 39 Tests the Timeline events for Animation Frame feature |
43 </p> | 40 </p> |
44 <div id="animation"> | 41 <div id="animation"> |
45 | 42 |
46 </div> | 43 </div> |
47 | 44 |
48 </body> | 45 </body> |
49 </html> | 46 </html> |
OLD | NEW |