OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
4 <script src="../../http/tests/inspector/timeline-test.js"></script> | |
5 <script> | |
6 | |
7 testRunner.setDumpConsoleMessages(false); | |
8 | |
9 function simpleConsoleTime() | |
10 { | |
11 console.time("a"); | |
12 console.timeEnd("a"); | |
13 } | |
14 | |
15 function nestedConsoleTime() | |
16 { | |
17 console.time("a"); | |
18 { | |
19 console.time("b"); | |
20 console.timeEnd("b"); | |
21 { | |
22 console.time("c"); | |
23 { | |
24 console.time("d"); | |
25 console.timeEnd("d"); | |
26 } | |
27 console.timeEnd("c"); | |
28 } | |
29 } | |
30 console.timeEnd("a"); | |
31 } | |
32 | |
33 | |
34 function unbalancedConsoleTime() | |
35 { | |
36 console.time("a"); | |
37 console.time("b"); | |
38 console.timeEnd("a"); | |
39 console.timeEnd("b"); | |
40 } | |
41 | |
42 function consoleTimeWithoutConsoleTimeEnd() | |
43 { | |
44 console.timeStamp("Foo"); | |
45 console.time("a"); | |
46 console.timeStamp("Bar"); | |
47 console.time("b"); | |
48 console.time("c"); | |
49 console.time("d"); | |
50 console.timeStamp("Baz"); | |
51 console.timeEnd("d"); | |
52 } | |
53 | |
54 function test() | |
55 { | |
56 InspectorTest.runTestSuite([ | |
57 function testSimpleConsoleTime(next) | |
58 { | |
59 performActions("simpleConsoleTime()", next); | |
60 }, | |
61 | |
62 function testNestedConsoleTime(next) | |
63 { | |
64 performActions("nestedConsoleTime()", next); | |
65 }, | |
66 | |
67 function testUnbalancedConsoleTime(next) | |
68 { | |
69 performActions("unbalancedConsoleTime()", next); | |
70 }, | |
71 | |
72 function testConsoleTimeWithoutConsoleTimeEnd(next) | |
73 { | |
74 performActions("consoleTimeWithoutConsoleTimeEnd()", next); | |
75 } | |
76 ]); | |
77 | |
78 function performActions(actions, next) | |
79 { | |
80 var namesToDump = new Set(["FunctionCall", "ConsoleTime", "TimeStamp"]); | |
81 function dumpName(event, level) | |
82 { | |
83 if (namesToDump.has(event.name)) | |
84 InspectorTest.addResult("----".repeat(level) + "> " + WebInspect
or.TimelineUIUtils.eventTitle(event)); | |
85 } | |
86 function callback() | |
87 { | |
88 InspectorTest.walkTimelineEventTree(dumpName); | |
89 next(); | |
90 } | |
91 WebInspector.panels.timeline._captureJSProfileSetting.set(false); | |
92 InspectorTest.evaluateWithTimeline(actions, InspectorTest.safeWrap(callb
ack), true); | |
93 } | |
94 } | |
95 | |
96 </script> | |
97 </head> | |
98 | |
99 <body onload="runTest()"> | |
100 <p>Test nesting of time/timeEnd records on Timeline</p> | |
101 | |
102 </body> | |
103 </html> | |
OLD | NEW |