Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / tracing / timeline-network-received-data.html
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 function performActions(callback)
8 {
9     function onImageLoad()
10     {
11         window._imageLoaded = true;
12         if (window._scriptEvaluated)
13             callback();
14     }
15
16     function scriptEvaluated()
17     {
18         window._scriptEvaluated = true;
19         if (window._imageLoaded)
20             callback();
21     }
22
23     var image = new Image();
24     image.onload = onImageLoad;
25     image.src = "resources/anImage.png";
26     var script = document.createElement("script");
27     script.src = "timeline-network-resource.js";
28     document.body.appendChild(script);
29
30     window.timelineNetworkResourceEvaluated = scriptEvaluated;
31 }
32
33 function test()
34 {
35     InspectorTest.invokeAsyncWithTimeline("performActions", done);
36
37     function done()
38     {
39         InspectorTest.addResult("Script evaluated.");
40         var record = InspectorTest.findFirstTimelineRecord("ResourceReceivedData");
41         if (record) {
42             if (record.data() && typeof record.data().encodedDataLength === "number")
43                 InspectorTest.addResult("Resource received data has length, test passed.");
44         }
45         InspectorTest.completeTest();
46     }
47 }
48
49 </script>
50 </head>
51
52 <body onload="runTest()">
53 <p>
54 Tests the Timeline API instrumentation of a network resource received data
55 </p>
56 </body>
57 </html>