| <html> |
| <head> |
| <script src="../http/tests/inspector/inspector-test.js"></script> |
| <script> |
| function test() { |
| var requestsToWatch = /\/network-test\.js$|\/non-existent-file.js$|^data:application\/javascript,|/; |
| var seenRequests = 0; |
| |
| function dumpRequests() |
| { |
| var logView = WebInspector.panels.network._networkLogView; |
| logView.refresh(); |
| var dataGrid = logView.element.querySelector("table.data"); |
| var urls = document.evaluate("//tbody/tr/td[position()=1]/div/@title", dataGrid, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); |
| var outputStrings = []; |
| |
| for (var i = 0; i < urls.snapshotLength; ++i) { |
| var url = urls.snapshotItem(i).value; |
| if (requestsToWatch.test(url)) { |
| var urlFragment = /^data:/.test(url) ? url.replace(/,.*$/, "") : url.replace(/.*\//, ""); |
| var status = document.evaluate("ancestor::tr/td[position()=3]", urls.snapshotItem(i), null, XPathResult.STRING_TYPE, null); |
| var outputStatus = status.stringValue; |
| // Truncate the status string on failure, since the description following "(failed)" is platform-dependent. |
| if (outputStatus.startsWith("(failed)")) |
| outputStatus = "(failed)"; |
| outputStrings.push(urlFragment + ": " + outputStatus); |
| } |
| } |
| outputStrings.sort(); |
| InspectorTest.addObject(outputStrings); |
| InspectorTest.completeTest(); |
| } |
| |
| function onRequestFinished(request) |
| { |
| if (!requestsToWatch.test(request.url)) |
| return; |
| if (++seenRequests === 3) |
| dumpRequests(); |
| } |
| |
| WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestFinished, onRequestFinished); |
| WebInspector.showPanel("network"); |
| InspectorTest.evaluateInPage("loadResources()"); |
| } |
| |
| function addScriptElement(src) |
| { |
| var element = document.createElement("script"); |
| element.src = src; |
| document.body.appendChild(element); |
| } |
| |
| function loadResources() |
| { |
| addScriptElement("../http/tests/inspector/network-test.js"); |
| addScriptElement("non-existent-file.js"); |
| addScriptElement("data:application/javascript,var x = 0;"); |
| } |
| |
| </script> |
| </head> |
| <body onload="runTest()"> |
| </body> |
| </html> |