Unreviewed, GTK css2.1 rebaseline after r101343.
[WebKit-https.git] / LayoutTests / inspector / network-status-non-http.html
1 <html>
2 <head>
3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script>
5 function test() {
6     var resourcesToWatch = /\/network-test\.js$|\/non-existent-file.js$|^data:application\/javascript,|/;
7     var seenResources = 0;
8
9     function dumpResources()
10     {
11         var logView = WebInspector.panels.network._networkLogView;
12         logView.refresh();
13         var dataGrid = logView.element.querySelector("table.data");
14         var urls = document.evaluate("//tbody/tr/td[position()=1]/div/@title", dataGrid, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
15         var outputStrings = [];
16
17         for (var i = 0; i < urls.snapshotLength; ++i) {
18             var url = urls.snapshotItem(i).value;
19             if (resourcesToWatch.test(url)) {
20                 var urlFragment = /^data:/.test(url) ? url.replace(/,.*$/, "") : url.replace(/.*\//, "");
21                 var status = document.evaluate("ancestor::tr/td[position()=3]", urls.snapshotItem(i), null, XPathResult.STRING_TYPE, null);
22                 outputStrings.push(urlFragment + ": " + status.stringValue);
23             }
24         }
25         outputStrings.sort();
26         InspectorTest.addObject(outputStrings);
27         InspectorTest.completeTest();
28     }
29
30     function onResourceFinished(resource)
31     {
32         if (!resourcesToWatch.test(resource.url))
33             return;
34         if (++seenResources === 3)
35             dumpResources();
36     }
37
38     WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, onResourceFinished);
39     WebInspector.showPanel("network");
40     InspectorTest.evaluateInPage("loadResources()");
41 }
42
43 function addScriptElement(src)
44 {
45     var element = document.createElement("script");
46     element.src = src;
47     document.body.appendChild(element);
48 }
49
50 function loadResources()
51 {
52     addScriptElement("../http/tests/inspector/network-test.js");
53     addScriptElement("non-existent-file.js");
54     addScriptElement("data:application/javascript,var x = 0;");
55 }
56
57 </script>
58 </head>
59 <body onload="runTest()">
60 </body>
61 </html>