| <html> |
| <head> |
| <script src="../../http/tests/inspector/inspector-test.js"></script> |
| <script src="../../http/tests/inspector/console-test.js"></script> |
| <script src="../../http/tests/inspector/timeline-test.js"></script> |
| <script> |
| |
| testRunner.setDumpConsoleMessages(false); |
| |
| function startStopTimeline() |
| { |
| console.timeStamp("timestamp 0"); |
| console.timeline("one"); |
| console.timeStamp("timestamp 1"); |
| console.timelineEnd("one"); |
| console.timeStamp("timestamp 2"); |
| } |
| |
| function startStopMultiple() |
| { |
| console.timeStamp("timestamp 0"); |
| console.timeline("one"); |
| console.timeStamp("timestamp 1"); |
| console.timeline("one"); |
| console.timeline("two"); |
| console.timeline("two"); |
| console.timelineEnd("two"); |
| console.timeStamp("timestamp 2"); |
| console.timelineEnd("one"); |
| console.timeStamp("timestamp 3"); |
| console.timelineEnd("two"); |
| console.timeStamp("timestamp 4"); |
| console.timelineEnd("one"); |
| console.timeStamp("timestamp 5"); |
| } |
| |
| function startMultiple() |
| { |
| console.timeStamp("timestamp 0"); |
| console.timeline("one"); |
| console.timeStamp("timestamp 1"); |
| console.timeline("two"); |
| console.timeStamp("timestamp 2"); |
| } |
| |
| function stopTwo() |
| { |
| console.timeStamp("timestamp 3"); |
| console.timelineEnd("two"); |
| console.timeStamp("timestamp 4"); |
| } |
| |
| function stopOne() |
| { |
| console.timeStamp("timestamp 5"); |
| console.timelineEnd("one"); |
| console.timeStamp("timestamp 6 - FAIL"); |
| } |
| |
| function stopUnknown() |
| { |
| console.timeStamp("timestamp 0"); |
| console.timeline("one"); |
| console.timeStamp("timestamp 1"); |
| console.timelineEnd("two"); |
| console.timeStamp("timestamp 2"); |
| console.timelineEnd("one"); |
| console.timeStamp("timestamp 3"); |
| } |
| |
| function startTimeline() |
| { |
| console.timeStamp("timestamp 0"); |
| console.timeline("one"); |
| console.timeStamp("timestamp 1"); |
| console.timeline("two"); |
| console.timeStamp("timestamp 2"); |
| } |
| |
| function test() |
| { |
| InspectorTest.runTestSuite([ |
| function testStartStopTimeline(next) |
| { |
| InspectorTest.evaluateWithTimeline("startStopTimeline()", allEventsReceived); |
| |
| function allEventsReceived() |
| { |
| printTimelineAndTimestampEvents(); |
| next(); |
| } |
| }, |
| |
| function testStartStopMultiple(next) |
| { |
| InspectorTest.evaluateWithTimeline("startStopMultiple()", allEventsReceived); |
| |
| function allEventsReceived() |
| { |
| printTimelineAndTimestampEvents(); |
| next(); |
| } |
| }, |
| |
| function testStartMultipleStopInsideEvals(next) |
| { |
| InspectorTest.startTimeline(step1); |
| |
| function step1() |
| { |
| InspectorTest.evaluateInPage("startMultiple()", step2); |
| } |
| |
| function step2() |
| { |
| InspectorTest.evaluateInPage("stopTwo()", step3); |
| } |
| |
| function step3() |
| { |
| InspectorTest.evaluateInPage("stopOne()", step4); |
| } |
| |
| function step4() |
| { |
| InspectorTest.stopTimeline(finish); |
| } |
| |
| function finish() |
| { |
| printTimelineAndTimestampEvents(); |
| next(); |
| } |
| }, |
| |
| function testStopUnknown(next) |
| { |
| InspectorTest.evaluateWithTimeline("stopUnknown()", allEventsReceived); |
| |
| function allEventsReceived() |
| { |
| printTimelineAndTimestampEvents(); |
| next(); |
| } |
| }, |
| |
| function testStartFromPanel(next) |
| { |
| InspectorTest.evaluateWithTimeline("startStopTimeline()", finish) |
| |
| function finish() |
| { |
| printTimelineAndTimestampEvents(); |
| next(); |
| } |
| }, |
| |
| function testStopFromPanel(next) |
| { |
| InspectorTest.evaluateWithTimeline("startTimeline()", finish) |
| |
| function finish() |
| { |
| printTimelineAndTimestampEvents(); |
| next(); |
| } |
| } |
| ]); |
| |
| function printTimelineAndTimestampEvents() { |
| InspectorTest.tracingModel().sortedProcesses().forEach(function(process) |
| { |
| process.sortedThreads().forEach(function(thread) |
| { |
| thread.events().forEach(function(event) |
| { |
| if (event.hasCategory(TimelineModel.TimelineModel.Category.Console)) |
| InspectorTest.addResult(event.name); |
| else if (event.name === TimelineModel.TimelineModel.RecordType.TimeStamp) |
| InspectorTest.addResult(event.args["data"]["message"]); |
| }); |
| }); |
| }); |
| } |
| } |
| |
| </script> |
| </head> |
| |
| <body onload="runTest()"> |
| <p> |
| Tests console.timeline and timelineEnd commands. |
| </p> |
| |
| </body> |
| </html> |