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 test() | 7 function test() |
| 8 { | 8 { |
| 9 function performActions(callback) | 9 function performActions(callback) |
| 10 { | 10 { |
| 11 var timerOne = setTimeout("1 + 1", 10); | 11 var timerOne = setTimeout("1 + 1", 10); |
| 12 var timerTwo = setInterval(intervalTimerWork, 20); | 12 var timerTwo = setInterval(intervalTimerWork, 20); |
| 13 var iteration = 0; | 13 var iteration = 0; |
| 14 | 14 |
| 15 function intervalTimerWork() | 15 function intervalTimerWork() |
| 16 { | 16 { |
| 17 if (++iteration < 2) | 17 if (++iteration < 2) |
| 18 return; | 18 return; |
| 19 clearInterval(timerTwo); | 19 clearInterval(timerTwo); |
| 20 callback(); | 20 callback(); |
| 21 } | 21 } |
| 22 } | 22 } |
| 23 | 23 |
| 24 var source = performActions.toString(); | 24 var source = performActions.toString(); |
| 25 source += "\n//@ sourceURL=performActions.js"; | 25 source += "\n//@ sourceURL=performActions.js"; |
| 26 InspectorTest.evaluateInPage(source); | 26 InspectorTest.evaluateInPage(source, startTimeline); |
| 27 | 27 |
| 28 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | 28 function startTimeline() |
| 29 { | |
| 30 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | |
| 31 } | |
| 29 | 32 |
| 30 var linkifier = new WebInspector.Linkifier(); | 33 var linkifier = new WebInspector.Linkifier(); |
| 31 | 34 |
| 32 var recordTypes = ["TimerInstall", "TimerRemove", "FunctionCall"]; | 35 var recordTypes = ["TimerInstall", "TimerRemove", "FunctionCall"]; |
| 33 function formatter(record) | 36 function formatter(record) |
| 34 { | 37 { |
| 35 if (recordTypes.indexOf(record.type()) === -1) | 38 if (recordTypes.indexOf(record.type()) === -1) |
| 36 return; | 39 return; |
| 37 | 40 |
| 38 var detailsText = WebInspector.TimelineUIUtils.buildDetailsTextForTraceE vent(record.traceEvent(), InspectorTest.timelineModel().target()); | 41 var detailsText = WebInspector.TimelineUIUtils.buildDetailsTextForTraceE vent(record.traceEvent(), InspectorTest.timelineModel().target()); |
| 39 if (detailsText) | 42 InspectorTest.addResult("detailsTextContent for " + record.type() + " ev ent: '" + detailsText.replace(/VM[\d]+/, "VM") + "'"); |
|
alph
2015/04/29 10:22:28
nit: no need for []
| |
| 40 InspectorTest.addResult("detailsTextContent for " + record.type() + " event: '" + detailsText + "'"); | |
| 41 | 43 |
| 42 var details = WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent (record.traceEvent(), InspectorTest.timelineModel().target(), linkifier); | 44 var details = WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent (record.traceEvent(), InspectorTest.timelineModel().target(), linkifier); |
| 43 if (details) | 45 InspectorTest.addResult("details.textContent for " + record.type() + " e vent: '" + details.textContent.replace(/VM[\d]+/, "VM") + "'"); |
|
alph
2015/04/29 10:22:28
ditto
| |
| 44 InspectorTest.addResult("details.textContent for " + record.type() + " event: '" + details.textContent + "'"); | |
| 45 } | 46 } |
| 46 | 47 |
| 47 function finish() | 48 function finish() |
| 48 { | 49 { |
| 49 InspectorTest.printTimelinePresentationRecords(null, formatter); | 50 InspectorTest.printTimelinePresentationRecords(null, formatter); |
| 50 InspectorTest.completeTest(); | 51 InspectorTest.completeTest(); |
| 51 } | 52 } |
| 52 } | 53 } |
| 53 | 54 |
| 54 if (!window.testRunner) | 55 if (!window.testRunner) |
| 55 setTimeout(performActions, 2000); | 56 setTimeout(performActions, 2000); |
| 56 | 57 |
| 57 </script> | 58 </script> |
| 58 </head> | 59 </head> |
| 59 | 60 |
| 60 <body onload="runTest()"> | 61 <body onload="runTest()"> |
| 61 <p> | 62 <p> |
| 62 Test that checks location resolving mechanics for TimerInstall TimerRemove and F unctionCall events with scriptId. | 63 Test that checks location resolving mechanics for TimerInstall TimerRemove and F unctionCall events with scriptId. |
| 63 </p><p> | 64 </p><p> |
| 64 It expects two FunctionCall for InjectedScript, two TimerInstall events, two Fun ctionCall events and one TimerRemove event to be logged with performActions.js s cript name and some line number. | 65 It expects two FunctionCall for InjectedScript, two TimerInstall events, two Fun ctionCall events and one TimerRemove event to be logged with performActions.js s cript name and some line number. |
| 65 </p> | 66 </p> |
| 66 </body> | 67 </body> |
| 67 </html> | 68 </html> |
| OLD | NEW |