Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script> | 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script> |
| 4 <script type="text/javascript" src="../../http/tests/inspector-protocol/tracing- test.js"></script> | 4 <script type="text/javascript" src="../../http/tests/inspector-protocol/tracing- test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function performActions(callback) | 7 function performActions() |
| 8 { | 8 { |
| 9 var callback; | |
| 10 var promise = new Promise((fulfill) => callback = fulfill); | |
| 9 var rafId1 = requestAnimationFrame(function() | 11 var rafId1 = requestAnimationFrame(function() |
| 10 { | 12 { |
| 11 evaluateInFrontend("InspectorTest.testFunctionRequestAnimationFrame(" + rafId1 + ", " + rafId2 + ")"); | 13 evaluateInFrontend("InspectorTest.testFunctionRequestAnimationFrame(" + rafId1 + ", " + rafId2 + ")"); |
|
caseq
2016/08/05 17:56:42
nit: this could be re-written in a much better way
kozy
2016/08/10 01:21:14
Done.
| |
| 12 callback(); | 14 callback(); |
| 13 }); | 15 }); |
| 14 | 16 |
| 15 var rafId2 = requestAnimationFrame(function() { }); | 17 var rafId2 = requestAnimationFrame(function() { }); |
| 16 cancelAnimationFrame(rafId2); | 18 cancelAnimationFrame(rafId2); |
| 19 return promise; | |
| 17 } | 20 } |
| 18 | 21 |
| 19 function test() | 22 function test() |
| 20 { | 23 { |
| 21 InspectorTest.invokeAsyncWithTracing("performActions", finish); | 24 InspectorTest.invokeAsyncWithTracing("performActions", finish); |
| 22 | 25 |
| 23 var firedRaf; | 26 var firedRaf; |
| 24 var canceledRaf; | 27 var canceledRaf; |
| 25 InspectorTest.testFunctionRequestAnimationFrame = function(rafId1, rafId2) | 28 InspectorTest.testFunctionRequestAnimationFrame = function(rafId1, rafId2) |
| 26 { | 29 { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 45 InspectorTest.log("SUCCESS: found all expected events."); | 48 InspectorTest.log("SUCCESS: found all expected events."); |
| 46 InspectorTest.completeTest(); | 49 InspectorTest.completeTest(); |
| 47 } | 50 } |
| 48 } | 51 } |
| 49 </script> | 52 </script> |
| 50 </head> | 53 </head> |
| 51 <body onLoad="runTest();"> | 54 <body onLoad="runTest();"> |
| 52 <div id="myDiv">DIV</div> | 55 <div id="myDiv">DIV</div> |
| 53 </body> | 56 </body> |
| 54 </html> | 57 </html> |
| OLD | NEW |