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 | 6 |
| 7 function performActions() | 7 function performActions(callback) |
| 8 { | 8 { |
| 9 window.callWhenDone = callback; | |
| 9 var content = "" + | 10 var content = "" + |
| 10 "var fn2 = function() {console.markTimeline(\"Script evaluated\");};\\n" + | 11 "var fn2 = function() {" + |
| 11 "var fn1 = function() {window.setTimeout(fn2, 1);};\\n" + | 12 " console.markTimeline(\"Script evaluated\");" + |
| 12 "window.setTimeout(fn1, 1);\\n" | 13 " window.callWhenDone();" + |
|
yurys
2014/07/17 10:42:24
I'd either revert this or add \n.
| |
| 13 content = "eval('" + content + "//# sourceURL=fromEval.js" + "');"; | 14 "};\\n" + |
| 15 "var fn1 = function() {" + | |
| 16 " window.setTimeout(fn2, 1);" + | |
| 17 "};\\n" + | |
| 18 "window.setTimeout(fn1, 1);\\n" + | |
| 19 "//# sourceURL=fromEval.js"; | |
| 20 content = "eval('" + content + "');"; | |
| 14 var scriptElement = document.createElement('script'); | 21 var scriptElement = document.createElement('script'); |
| 15 var contentNode = document.createTextNode(content); | 22 var contentNode = document.createTextNode(content); |
| 16 scriptElement.appendChild(contentNode); | 23 scriptElement.appendChild(contentNode); |
| 17 document.body.appendChild(scriptElement); | 24 document.body.appendChild(scriptElement); |
| 18 document.body.removeChild(scriptElement); | 25 document.body.removeChild(scriptElement); |
| 19 } | 26 } |
| 20 | 27 |
| 21 function test() | 28 function test() |
| 22 { | 29 { |
| 23 InspectorTest.startTimeline(start); | 30 InspectorTest.invokeAsyncWithTimeline("performActions", finish); |
| 24 InspectorTest.waitForRecordType("TimeStamp", finish); | |
| 25 | |
| 26 function start() | |
| 27 { | |
| 28 InspectorTest.evaluateInPage("performActions()"); | |
| 29 } | |
| 30 | 31 |
| 31 function finish() | 32 function finish() |
| 32 { | 33 { |
| 33 function formatter(record) | 34 function formatter(record) |
| 34 { | 35 { |
| 35 if (record.type === "TimerFire") { | 36 if (record.type === "TimerFire") { |
| 36 var fnCallSite = record.children[0].data; | 37 var fnCallSite = record.children[0].data; |
| 37 InspectorTest.addResult(record.type + " " + fnCallSite.scriptNam e + ":" + fnCallSite.scriptLine); | 38 InspectorTest.addResult(record.type + " " + fnCallSite.scriptNam e + ":" + fnCallSite.scriptLine); |
| 38 } | 39 } |
| 39 } | 40 } |
| 40 InspectorTest.printTimelineRecords(null, formatter); | 41 InspectorTest.printTimelineRecords(null, formatter); |
| 41 InspectorTest.completeTest(); | 42 InspectorTest.completeTest(); |
| 42 } | 43 } |
| 43 } | 44 } |
| 44 | 45 |
| 45 if (!window.testRunner) | 46 if (!window.testRunner) |
| 46 setTimeout(performActions, 3000); | 47 setTimeout(performActions, 3000); |
| 47 | 48 |
| 48 </script> | 49 </script> |
| 49 </head> | 50 </head> |
| 50 | 51 |
| 51 <body onload="runTest()"> | 52 <body onload="runTest()"> |
| 52 <p> | 53 <p> |
| 53 Tests the Timeline API instrumentation of a TimerFired events inside evaluated s cripts. | 54 Tests the Timeline API instrumentation of a TimerFired events inside evaluated s cripts. |
| 54 </p> | 55 </p> |
| 55 | 56 |
| 56 </body> | 57 </body> |
| 57 </html> | 58 </html> |
| OLD | NEW |