Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: LayoutTests/inspector-protocol/network/resource-type.html

Issue 114123005: Show media and VTT text tracks in the devtools. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed feedback. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/network/resource-type-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/inspector-protocol/network/resource-type.html
diff --git a/LayoutTests/inspector-protocol/network/resource-type.html b/LayoutTests/inspector-protocol/network/resource-type.html
new file mode 100644
index 0000000000000000000000000000000000000000..4bdbdb2a241536da8acd6b2ea428613b8db716a3
--- /dev/null
+++ b/LayoutTests/inspector-protocol/network/resource-type.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
+<script>
+function appendIframe()
+{
+ var iframe = document.createElement("iframe");
+ iframe.src = "resources/resources-page.html";
+ document.body.appendChild(iframe);
+}
+
+function test()
+{
+ InspectorTest.eventHandler["Network.responseReceived"] = onResponseReceived;
+
+ function enableNetwork()
+ {
+ InspectorTest.log("Test started");
+ InspectorTest.sendCommand("Network.enable", {}, didEnableNetwork);
+ }
+
+ function didEnableNetwork(messageObject)
+ {
+ if (messageObject.error) {
+ InspectorTest.log("FAIL: Couldn't enable network agent" + messageObject.error.message);
+ InspectorTest.completeTest();
+ return;
+ }
+ InspectorTest.log("Network agent enabled");
+ InspectorTest.sendCommand("Runtime.evaluate", { "expression": "appendIframe()"});
+ }
+
+ var resources = [
+ { url: '/resources-page.html', type: "Document" },
+ { url: '/stylesheet.css', type: "Stylesheet" },
+ { url: '/script.js', type: "Script" },
+ { url: '/abe.png', type: "Image" },
+ { url: '/test.wav', type: "Media" },
+ { url: '/test.ogv', type: "Media" },
+ { url: '/simple-captions.vtt', type: "TextTrack" },
+ ];
+ var resourcesLeft = resources.length;
+
+ function onResponseReceived(event)
+ {
+ var url = event.params.response.url;
+ var type = event.params.type;
+ for (var i = 0; i < resources.length; ++i) {
+ var resource = resources[i];
+ if (url.substring(url.length - resource.url.length) === resource.url) {
+ if (resource.gotType) {
+ InspectorTest.log("FAIL: Received resource " + url + " twice.");
+ InspectorTest.completeTest();
+ }
+ resource.gotType = type;
+ resource.gotUrl = url;
+ resourcesLeft -= 1;
+ if (resourcesLeft === 0)
+ receivedAllResources();
+ return;
+ }
+ }
+ InspectorTest.log("FAIL: received unexpected resource " + url);
+ InspectorTest.completeTest();
+ }
+
+ function receivedAllResources()
+ {
+ for (var i = 0; i < resources.length; ++i) {
+ var resource = resources[i];
+ InspectorTest.log("Resource " + resource.url + " got type " + resource.gotType);
+ InspectorTest.assertEquals(resource.type, resource.gotType);
+ }
+ InspectorTest.completeTest();
+ }
+
+ enableNetwork();
+}
+</script>
+</head>
+<body onload="runTest();">
+<p>Tests that responseReceived contains the
+ <a href="https://developers.google.com/chrome-developer-tools/docs/protocol/tot/page#type-ResourceType">documented resource types</a>.
+</p>
+</body>
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/network/resource-type-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698