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 function performActions() | 7 function performActions() |
8 { | 8 { |
9 var image = new Image(); | 9 var image = new Image(); |
10 var imagePromise = new Promise((fulfill) => image.onload = fulfill); | 10 var imagePromise = new Promise((fulfill) => image.onload = fulfill); |
11 image.src = "../resources/anImage.png"; | 11 image.src = "../resources/anImage.png"; |
12 | 12 |
13 var scriptPromise = new Promise((fulfill) => window.timelineNetworkResourceE
valuated = fulfill); | 13 var scriptPromise = new Promise((fulfill) => window.timelineNetworkResourceE
valuated = fulfill); |
14 var script = document.createElement("script"); | 14 var script = document.createElement("script"); |
15 script.src = "timeline-network-resource.js"; | 15 script.src = "timeline-network-resource.js"; |
16 document.body.appendChild(script); | 16 document.body.appendChild(script); |
17 | 17 |
18 return Promise.all([imagePromise, scriptPromise]); | 18 return Promise.all([imagePromise, scriptPromise]); |
19 } | 19 } |
20 | 20 |
21 function test() | 21 function test() |
22 { | 22 { |
23 InspectorTest.invokeAsyncWithTimeline("performActions", done); | 23 InspectorTest.invokeAsyncWithTimeline("performActions", done); |
24 | 24 |
25 function done() | 25 function done() |
26 { | 26 { |
27 InspectorTest.addResult("Script evaluated."); | 27 InspectorTest.addResult("Script evaluated."); |
28 var record = InspectorTest.findFirstTimelineRecord("ResourceReceivedData
"); | |
29 if (record) { | |
30 var data = record.traceEvent().args["data"]; | |
31 if (data && typeof data.encodedDataLength === "number") | |
32 InspectorTest.addResult("Resource received data has length, test
passed."); | |
33 } | |
34 InspectorTest.completeTest(); | 28 InspectorTest.completeTest(); |
35 } | 29 } |
36 } | 30 } |
37 | 31 |
38 </script> | 32 </script> |
39 </head> | 33 </head> |
40 | 34 |
41 <body onload="runTest()"> | 35 <body onload="runTest()"> |
42 <p> | 36 <p> |
43 Tests the Timeline API instrumentation of a network resource received data | 37 Tests the Timeline API instrumentation of a network resource received data |
44 </p> | 38 </p> |
45 </body> | 39 </body> |
46 </html> | 40 </html> |
OLD | NEW |