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 src="../../tracing-test.js"></script> | |
6 <script> | |
7 function test() | |
8 { | |
9 var sessionId = "4.20"; | |
10 var mainThread = 1; | |
11 var pid = 100; | |
12 | |
13 var commonMetadata = [ | |
14 { | |
15 "args": { "sessionId": sessionId }, | |
16 "cat": "disabled-by-default-devtools.timeline", | |
17 "name": "TracingStartedInPage", | |
18 "ph": "I", | |
19 "pid": pid, | |
20 "tid": mainThread, | |
21 "ts": 100, | |
22 }, | |
23 { | |
24 "args": { "layerTreeId": 17 }, | |
25 "cat": "disabled-by-default-devtools.timeline", | |
26 "name": "SetLayerTreeId", | |
27 "ph": "I", | |
28 "pid": pid, | |
29 "tid": mainThread, | |
30 "ts": 101, | |
31 } | |
32 ]; | |
33 | |
34 var traceEvents = [ | |
35 {"name": "Program", "ts": 1000000, "dur": 9999, "ph": "X", args: {}, "t
id": mainThread, "pid": 100, "cat":"disabled-by-default.devtools.timeline" }, | |
36 {"name": "FunctionCall", "ts": 1000001, "dur": 9998, "ph": "X", args: {}
, "tid": mainThread, "pid": 100, "cat":"disabled-by-default.devtools.timeline" }
, | |
37 {"name": "ResourceSendRequest", "ts": 1000002, "ph": "I", args: {"data":
{"requestId": 1, "url": "http://example.com", "requestMethod": "GET"}}, "tid": m
ainThread, "pid": 100, "cat":"disabled-by-default.devtools.timeline" }, | |
38 {"name": "RecalculateStyles", "ts": 1001003, "dur": 997, "ph": "X", args
: {}, "tid": mainThread, "pid": 100, "cat":"disabled-by-default.devtools.timelin
e"}, | |
39 {"name": "Layout", "ts": 1002001, "ph": "B", args: {beginData: {}}, "tid
": mainThread, "pid": 100, "cat":"disabled-by-default.devtools.timeline"}, | |
40 {"name": "Layout", "ts": 1003000, "ph": "E", args: {endData: {}}, "tid":
mainThread, "pid": 100, "cat":"disabled-by-default.devtools.timeline"}, | |
41 | |
42 {"name": "Program", "ts": 2000000, "ph": "B", args: {}, "tid": mainThre
ad, "pid": 100, "cat":"disabled-by-default.devtools.timeline" }, | |
43 {"name": "FunctionCall", "ts": 2000001, "ph": "B", args: {}, "tid": main
Thread, "pid": 100, "cat":"disabled-by-default.devtools.timeline" }, | |
44 {"name": "ResourceSendRequest", "ts": 2000002, "ph": "I", args: {"data":
{"requestId": 1, "url": "http://example.com", "requestMethod": "GET"}}, "tid": m
ainThread, "pid": 100, "cat":"disabled-by-default.devtools.timeline" }, | |
45 {"name": "RecalculateStyles", "ts": 2001003, "ph": "B", args: {}, "tid":
mainThread, "pid": 100, "cat":"disabled-by-default.devtools.timeline"}, | |
46 {"name": "RecalculateStyles", "ts": 2002000, "ph": "E", args: {}, "tid":
mainThread, "pid": 100, "cat":"disabled-by-default.devtools.timeline"}, | |
47 {"name": "Layout", "ts": 2002101, "ph": "B", args: {beginData: {}}, "tid
": mainThread, "pid": 100, "cat":"disabled-by-default.devtools.timeline"}, | |
48 {"name": "Layout", "ts": 2003001, "ph": "E", args: {endData: {}}, "tid":
mainThread, "pid": 100, "cat":"disabled-by-default.devtools.timeline"}, | |
49 {"name": "FunctionCall", "ts": 2009999, "ph": "E", args: {}, "tid": main
Thread, "pid": 100, "cat":"disabled-by-default.devtools.timeline" }, | |
50 {"name": "Program", "ts": 2009999, "ph": "E", args: {}, "tid": mainThre
ad, "pid": 100, "cat":"disabled-by-default.devtools.timeline"} | |
51 ]; | |
52 | |
53 var recordsFromEvent = []; | |
54 function onRecordAdded(event) | |
55 { | |
56 recordsFromEvent.push(event.data); | |
57 } | |
58 var tracingTimelineModel = InspectorTest.tracingTimelineModel; | |
59 tracingTimelineModel.addEventListener(WebInspector.TimelineModel.Events.Reco
rdAdded, onRecordAdded); | |
60 tracingTimelineModel.setEventsForTest(sessionId, commonMetadata.concat(trace
Events)); | |
61 var records = tracingTimelineModel.records(); | |
62 InspectorTest.assertEquals(records.length, recordsFromEvent.length); | |
63 for (var i = 0; i < records.length; ++i) { | |
64 InspectorTest.assertEquals(records[i], recordsFromEvent[i]); | |
65 InspectorTest.dumpTimelineModelRecord(records[i]); | |
66 } | |
67 InspectorTest.completeTest(); | |
68 } | |
69 | |
70 </script> | |
71 </head> | |
72 | |
73 <body onload="runTest()"> | |
74 <p> | |
75 Test trace-specific implementation of timeline model | |
76 </p> | |
77 | |
78 </body> | |
79 </html> | |
OLD | NEW |