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 var scriptUrl = "timeline-network-resource.js"; | 7 var scriptUrl = "timeline-network-resource.js"; |
8 | 8 |
9 function performActions(callback) | 9 function performActions(callback) |
10 { | 10 { |
(...skipping 12 matching lines...) Expand all Loading... |
23 var presentationModel = InspectorTest.timelinePresentationModel(); | 23 var presentationModel = InspectorTest.timelinePresentationModel(); |
24 | 24 |
25 InspectorTest.invokeAsyncWithTimeline("performActions", finish); | 25 InspectorTest.invokeAsyncWithTimeline("performActions", finish); |
26 | 26 |
27 function finish() | 27 function finish() |
28 { | 28 { |
29 var lastRecordStartTime; | 29 var lastRecordStartTime; |
30 function format(record) | 30 function format(record) |
31 { | 31 { |
32 if (record.type() === WebInspector.TimelineModel.RecordType.Resource
SendRequest) | 32 if (record.type() === WebInspector.TimelineModel.RecordType.Resource
SendRequest) |
33 printSend(record._record); | 33 printSend(record); |
34 else if (record.type() === WebInspector.TimelineModel.RecordType.Res
ourceReceiveResponse) | 34 else if (record.type() === WebInspector.TimelineModel.RecordType.Res
ourceReceiveResponse) |
35 printReceive(record._record); | 35 printReceive(record); |
36 else if (record.type() === WebInspector.TimelineModel.RecordType.Res
ourceFinish) | 36 else if (record.type() === WebInspector.TimelineModel.RecordType.Res
ourceFinish) |
37 printFinish(record._record); | 37 printFinish(record); |
38 | 38 |
39 if (record.parent && record.parent.type() === WebInspector.TimelineM
odel.RecordType.Root) { | 39 var presentationRecord = presentationModel.toPresentationRecord(reco
rd); |
40 if (lastRecordStartTime) | 40 if (presentationRecord && record.thread() === WebInspector.TimelineM
odel.MainThreadName) { |
41 InspectorTest.assertGreaterOrEqual(record.startTime(), lastR
ecordStartTime, "Top level records order violation"); | 41 var parentIsRoot = presentationRecord.presentationParent() && !p
resentationRecord.presentationParent().presentationParent(); |
42 lastRecordStartTime = record.startTime(); | 42 if (parentIsRoot) { |
| 43 if (lastRecordStartTime) |
| 44 InspectorTest.assertGreaterOrEqual(record.startTime(), l
astRecordStartTime, "Top level records order violation"); |
| 45 lastRecordStartTime = record.startTime(); |
| 46 } |
43 } | 47 } |
44 } | 48 } |
45 model.forAllRecords(format); | 49 model.forAllRecords(format); |
46 InspectorTest.completeTest(); | 50 InspectorTest.completeTest(); |
47 } | 51 } |
48 | 52 |
49 function printRecord(record) | 53 function printRecord(record) |
50 { | 54 { |
51 InspectorTest.addResult(""); | 55 InspectorTest.addResult(""); |
52 InspectorTest.printTimelineRecordProperties(record); | 56 InspectorTest.printTimelineRecordProperties(record); |
53 } | 57 } |
54 | 58 |
55 function printSend(record) | 59 function printSend(record) |
56 { | 60 { |
57 printRecord(record); | 61 printRecord(record); |
58 requestId = record.data.requestId; | 62 requestId = record.data().requestId; |
59 if (record.data.url === undefined) | 63 if (record.data().url === undefined) |
60 InspectorTest.addResult("* No 'url' property in record"); | 64 InspectorTest.addResult("* No 'url' property in record"); |
61 else if (record.data.url.indexOf(scriptUrl) === -1) | 65 else if (record.data().url.indexOf(scriptUrl) === -1) |
62 InspectorTest.addResult("* Didn't find URL: " + scriptUrl); | 66 InspectorTest.addResult("* Didn't find URL: " + scriptUrl); |
63 } | 67 } |
64 | 68 |
65 function printReceive(record) | 69 function printReceive(record) |
66 { | 70 { |
67 printRecord(record); | 71 printRecord(record); |
68 if (requestId !== record.data.requestId) | 72 if (requestId !== record.data().requestId) |
69 InspectorTest.addResult("Didn't find matching requestId: " + request
Id); | 73 InspectorTest.addResult("Didn't find matching requestId: " + request
Id); |
70 if (record.data.statusCode !== 0) | 74 if (record.data().statusCode !== 0) |
71 InspectorTest.addResult("Response received status: " + record.data.s
tatusCode); | 75 InspectorTest.addResult("Response received status: " + record.data()
.statusCode); |
72 } | 76 } |
73 | 77 |
74 function printFinish(record) | 78 function printFinish(record) |
75 { | 79 { |
76 printRecord(record); | 80 printRecord(record); |
77 if (requestId !== record.data.requestId) | 81 if (requestId !== record.data().requestId) |
78 InspectorTest.addResult("Didn't find matching requestId: " + request
Id); | 82 InspectorTest.addResult("Didn't find matching requestId: " + request
Id); |
79 if (record.data.didFail) | 83 if (record.data().didFail) |
80 InspectorTest.addResult("Request failed."); | 84 InspectorTest.addResult("Request failed."); |
81 } | 85 } |
82 } | 86 } |
83 | 87 |
84 </script> | 88 </script> |
85 </head> | 89 </head> |
86 | 90 |
87 <body onload="runTest()"> | 91 <body onload="runTest()"> |
88 <p> | 92 <p> |
89 Tests the Timeline API instrumentation of a network resource load | 93 Tests the Timeline API instrumentation of a network resource load |
90 </p> | 94 </p> |
91 </body> | 95 </body> |
92 </html> | 96 </html> |
OLD | NEW |