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 function test() | |
7 { | |
8 var mainThread = 1; | |
9 var pid = 100; | |
10 | |
11 var testData = [ | |
12 { "cat": "cat", "name": "flowSimple", "ph": "s", "ts": 100000, "args": {
}, "id": 1, "tid": mainThread, "pid": pid }, | |
13 { "cat": "cat", "name": "flowSimple", "ph": "f", "ts": 101000, "args": {
}, "id": 1, "tid": mainThread, "pid": pid }, | |
14 | |
15 { "cat": "cat", "name": "flowStep", "ph": "s", "ts": 120000, "args": {},
"id": 1, "tid": mainThread, "pid": pid }, | |
16 { "cat": "cat", "name": "flowStep", "ph": "t", "ts": 121001, "args": {},
"id": 1, "tid": mainThread, "pid": pid }, | |
17 { "cat": "cat", "name": "flowStep", "ph": "t", "ts": 126100, "args": {},
"id": 1, "tid": mainThread, "pid": pid }, | |
18 { "cat": "cat", "name": "flowStep", "ph": "f", "ts": 126999, "args": {},
"id": 1, "tid": mainThread, "pid": pid }, | |
19 | |
20 { "cat": "cat", "name": "flowCrossThread", "ph": "t", "ts": 130200, "arg
s": {}, "id": 1, "tid": 2, "pid": pid }, | |
21 { "cat": "cat", "name": "flowCrossThread", "ph": "t", "ts": 130800, "arg
s": {}, "id": 1, "tid": 2, "pid": pid }, | |
22 { "cat": "cat", "name": "flowCrossThread", "ph": "s", "ts": 130000, "arg
s": {}, "id": 1, "tid": mainThread, "pid": pid }, | |
23 { "cat": "cat", "name": "flowCrossThread", "ph": "f", "ts": 131000, "arg
s": {}, "id": 1, "tid": mainThread, "pid": pid }, | |
24 | |
25 { "cat": "cat", "name": "flowIdName", "ph": "s", "ts": 140000, "args": {
}, "id": 1, "tid": mainThread, "pid": pid }, | |
26 { "cat": "cat", "name": "flowIdName1", "ph": "s", "ts": 140220, "args":
{}, "id": 1, "tid": mainThread, "pid": pid }, | |
27 { "cat": "cat", "name": "flowIdName", "ph": "f", "ts": 140800, "args": {
}, "id": 1, "tid": mainThread, "pid": pid }, | |
28 { "cat": "cat", "name": "flowIdName1", "ph": "f", "ts": 141000, "args":
{}, "id": 1, "tid": mainThread, "pid": pid }, | |
29 | |
30 { "cat": "cat", "name": "flowIdCat", "ph": "s", "ts": 150000, "args": {}
, "id": 1, "tid": mainThread, "pid": pid }, | |
31 { "cat": "cat1", "name": "flowIdCat", "ph": "s", "ts": 151000, "args": {
}, "id": 1, "tid": mainThread, "pid": pid }, | |
32 { "cat": "cat", "name": "flowIdCat", "ph": "f", "ts": 152000, "args": {}
, "id": 1, "tid": mainThread, "pid": pid }, | |
33 { "cat": "cat1", "name": "flowIdCat", "ph": "f", "ts": 153000, "args": {
}, "id": 1, "tid": mainThread, "pid": pid }, | |
34 | |
35 { "cat": "cat", "name": "flowIdScope", "ph": "s", "ts": 153500, "args":
{}, "scope": "s1", "id": 1, "tid": mainThread, "pid": pid }, | |
36 { "cat": "cat", "name": "flowIdScope", "ph": "s", "ts": 154000, "args":
{}, "scope": "s2", "id": 1, "tid": mainThread, "pid": pid }, | |
37 { "cat": "cat", "name": "flowIdScope", "ph": "f", "ts": 154000, "args":
{}, "scope": "s1", "id": 1, "tid": mainThread, "pid": pid }, | |
38 { "cat": "cat", "name": "flowIdScope", "ph": "f", "ts": 154500, "args":
{}, "scope": "s2", "id": 1, "tid": mainThread, "pid": pid }, | |
39 | |
40 { "cat": "cat", "name": "flowIdLocal", "ph": "s", "ts": 155000, "args":
{}, "id2": {"local": 1}, "tid": mainThread, "pid": pid }, | |
41 { "cat": "cat", "name": "flowIdLocal", "ph": "s", "ts": 155100, "args":
{}, "id2": {"local": 1}, "tid": mainThread, "pid": pid + 1 }, | |
42 { "cat": "cat", "name": "flowIdLocal", "ph": "f", "ts": 155500, "args":
{}, "id2": {"local": 1}, "tid": mainThread, "pid": pid }, | |
43 { "cat": "cat", "name": "flowIdLocal", "ph": "f", "ts": 155600, "args":
{}, "id2": {"local": 1}, "tid": mainThread, "pid": pid + 1}, | |
44 | |
45 { "cat": "cat", "name": "flowIdGlobal", "ph": "s", "ts": 156500, "args":
{}, "id2": {"global": 1}, "tid": mainThread, "pid": pid }, | |
46 { "cat": "cat", "name": "flowIdGlobal", "ph": "t", "ts": 157500, "args":
{}, "id2": {"global": 1}, "tid": mainThread, "pid": pid + 1}, | |
47 { "cat": "cat", "name": "flowIdGlobal", "ph": "t", "ts": 157600, "args":
{}, "id2": {"global": 1}, "tid": mainThread, "pid": pid }, | |
48 ]; | |
49 | |
50 var model = InspectorTest.createTracingModel(); | |
51 model.setEventsForTest(testData); | |
52 var heads = model.flowHeads(); | |
53 for (var h of heads) { | |
54 var str = `${h.name}#${h.id} `; | |
55 for (;h; h = h.nextFlow) { | |
56 str += `${h.phase}:${h.startTime} ` | |
57 } | |
58 InspectorTest.addResult(str); | |
59 } | |
60 InspectorTest.completeTest(); | |
61 } | |
62 | |
63 </script> | |
64 </head> | |
65 <body onload="runTest()"> | |
66 <p>Test that tracing model correctly processes flow events.</p> | |
67 </body> | |
68 </html> | |
OLD | NEW |