Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / network / network-status-non-http.html
blob84eb6c51c921a99ad8e1c1569fc1ff607450ae2d
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/network-test.js"></script>
5 <script>
6 function test()
8 var requestsToWatch = /\/network-test\.js$|\/non-existent-file.js$|^data:application\/javascript,|/;
9 var seenRequests = 0;
11 function dumpRequests()
13 var logView = WebInspector.panels.network._networkLogView;
14 logView.refresh();
15 var dataGrid = logView.element.querySelector("table.data");
16 var urls = document.evaluate("//tbody/tr/td[position()=1]/@title", dataGrid, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
17 var outputStrings = [];
19 for (var request of WebInspector.targetManager.mainTarget().networkLog._requests) {
20 var line = request.displayName + ":" + request.statusCode + " " + request.statusText
21 if (request.failed)
22 line += "(failed)";
23 else if (request.finished)
24 line += "Finished";
25 InspectorTest.addResult(line);
27 InspectorTest.completeTest();
30 function onRequestFinished(request)
32 if (!requestsToWatch.test(request.url))
33 return;
34 if (++seenRequests === 3)
35 setTimeout(dumpRequests);
38 InspectorTest.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestFinished, onRequestFinished);
39 InspectorTest.recordNetwork();
40 InspectorTest.evaluateInPage("loadResources()");
43 function addScriptElement(src)
45 var element = document.createElement("script");
46 element.src = src;
47 document.body.appendChild(element);
50 function loadResources()
52 addScriptElement("../../http/tests/inspector/network-test.js");
53 addScriptElement("non-existent-file.js");
55 // Test that data-url doesn't appear in network panel.
56 addScriptElement("data:application/javascript,var x = 0;");
59 </script>
60 </head>
61 <body onload="runTest()">
62 </body>
63 </html>