Chromium Code Reviews| 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 test() | 6 function test() |
| 7 { | 7 { |
| 8 function checkStringContains(string, contains) | 8 function checkStringContains(string, contains) |
| 9 { | 9 { |
| 10 var doesContain = string.indexOf(contains) >= 0; | 10 var doesContain = string.indexOf(contains) >= 0; |
| 11 InspectorTest.check(doesContain, contains + " should be present in " + s tring); | 11 InspectorTest.check(doesContain, contains + " should be present in " + s tring); |
| 12 InspectorTest.addResult("PASS - record contained " + contains); | 12 InspectorTest.addResult("PASS - record contained " + contains); |
| 13 } | 13 } |
| 14 | 14 |
| 15 InspectorTest.runTestSuite([ | 15 InspectorTest.runTestSuite([ |
| 16 function testTimerInstall(next) | 16 function testTimerInstall(next) |
| 17 { | 17 { |
| 18 function setTimeoutFunction(callback) | 18 function setTimeoutFunction() |
| 19 { | 19 { |
| 20 var callback; | |
| 21 var promise = new Promise((fulfill) => callback = fulfill); | |
| 20 setTimeout(callback, 0); | 22 setTimeout(callback, 0); |
|
caseq
2016/08/10 22:44:55
return new Promise(fullfil => setTimeout(fullfil,
kozy
2016/08/11 01:34:16
Done.
| |
| 23 return promise; | |
| 21 } | 24 } |
| 22 | 25 |
| 23 var source = setTimeoutFunction.toString(); | 26 var source = setTimeoutFunction.toString(); |
| 24 source += "\n//# sourceURL=setTimeoutFunction.js"; | 27 source += "\n//# sourceURL=setTimeoutFunction.js"; |
| 25 InspectorTest.evaluateInPage(source); | 28 InspectorTest.evaluateInPage(source); |
| 26 | 29 |
| 27 InspectorTest.invokeAsyncWithTimeline("setTimeoutFunction", finishAn dRunNextTest); | 30 InspectorTest.invokeAsyncWithTimeline("setTimeoutFunction", finishAn dRunNextTest); |
| 28 function finishAndRunNextTest() | 31 function finishAndRunNextTest() |
| 29 { | 32 { |
| 30 var linkifier = new WebInspector.Linkifier(); | 33 var linkifier = new WebInspector.Linkifier(); |
| 31 var record = InspectorTest.findFirstTimelineRecord("TimerFire"); | 34 var record = InspectorTest.findFirstTimelineRecord("TimerFire"); |
| 32 InspectorTest.check(record, "Should receive a TimerFire record." ); | 35 InspectorTest.check(record, "Should receive a TimerFire record." ); |
| 33 var event = record.traceEvent(); | 36 var event = record.traceEvent(); |
| 34 var contentHelper = new WebInspector.TimelineDetailsContentHelpe r(InspectorTest.timelineModel().targetByEvent(event), linkifier, true); | 37 var contentHelper = new WebInspector.TimelineDetailsContentHelpe r(InspectorTest.timelineModel().targetByEvent(event), linkifier, true); |
| 35 WebInspector.TimelineUIUtils._generateCauses(event, InspectorTes t.timelineModel().targetByEvent(event), null, contentHelper); | 38 WebInspector.TimelineUIUtils._generateCauses(event, InspectorTes t.timelineModel().targetByEvent(event), null, contentHelper); |
| 36 var causes = contentHelper.element.deepTextContent(); | 39 var causes = contentHelper.element.deepTextContent(); |
| 37 InspectorTest.check(causes, "Should generate causes"); | 40 InspectorTest.check(causes, "Should generate causes"); |
| 38 checkStringContains(causes, "Timer InstalledsetTimeoutFunction @ setTimeoutFunction.js:"); | 41 checkStringContains(causes, "Timer InstalledsetTimeoutFunction @ setTimeoutFunction.js:"); |
| 39 next(); | 42 next(); |
| 40 } | 43 } |
| 41 }, | 44 }, |
| 42 | 45 |
| 43 function testRequestAnimationFrame(next) | 46 function testRequestAnimationFrame(next) |
| 44 { | 47 { |
| 45 function requestAnimationFrameFunction(callback) | 48 function requestAnimationFrameFunction(callback) |
| 46 { | 49 { |
| 50 var callback; | |
| 51 var promise = new Promise((fulfill) => callback = fulfill); | |
| 47 requestAnimationFrame(callback); | 52 requestAnimationFrame(callback); |
| 53 return promise; | |
| 48 } | 54 } |
| 49 | 55 |
| 50 var source = requestAnimationFrameFunction.toString(); | 56 var source = requestAnimationFrameFunction.toString(); |
| 51 source += "\n//# sourceURL=requestAnimationFrameFunction.js"; | 57 source += "\n//# sourceURL=requestAnimationFrameFunction.js"; |
| 52 InspectorTest.evaluateInPage(source); | 58 InspectorTest.evaluateInPage(source); |
| 53 | 59 |
| 54 InspectorTest.invokeAsyncWithTimeline("requestAnimationFrameFunction ", finishAndRunNextTest); | 60 InspectorTest.invokeAsyncWithTimeline("requestAnimationFrameFunction ", finishAndRunNextTest); |
| 55 function finishAndRunNextTest() | 61 function finishAndRunNextTest() |
| 56 { | 62 { |
| 57 var linkifier = new WebInspector.Linkifier(); | 63 var linkifier = new WebInspector.Linkifier(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 </script> | 136 </script> |
| 131 </head> | 137 </head> |
| 132 | 138 |
| 133 <body onload="runTest()"> | 139 <body onload="runTest()"> |
| 134 <p> | 140 <p> |
| 135 Test that causes are correctly generated for various types of events. | 141 Test that causes are correctly generated for various types of events. |
| 136 </p> | 142 </p> |
| 137 <div id="testElement"></div> | 143 <div id="testElement"></div> |
| 138 </body> | 144 </body> |
| 139 </html> | 145 </html> |
| OLD | NEW |