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

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

Issue 2961493002: [DevTools] Migrate inspector-protocol/{input,network} tests to new harness (Closed)
Patch Set: minor fixes Created 3 years, 6 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
Index: third_party/WebKit/LayoutTests/inspector-protocol/network/resource-type.html
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/network/resource-type.html b/third_party/WebKit/LayoutTests/inspector-protocol/network/resource-type.html
deleted file mode 100644
index 2049b69aa08c6ab3461333b22f740b94c34bdad1..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/network/resource-type.html
+++ /dev/null
@@ -1,125 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../http/tests/inspector-protocol/resources/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;
- InspectorTest.eventHandler["Network.loadingFinished"] = onLoadingFinished;
-
- 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", responseAvailable: false },
- { 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" },
- { url: '/greenbox.png', type: "XHR" }
- ];
- var resourcesLeft = resources.length;
-
- function onResponseReceived(event)
- {
- var url = event.params.response.url;
- if (url.indexOf("blob") === 0)
- return;
-
- var type = event.params.type;
- var requestId = event.params.requestId;
- 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;
- resource.requestId = requestId;
- return;
- }
- }
- InspectorTest.log("FAIL: received unexpected resource " + url);
- InspectorTest.completeTest();
- }
-
- function onLoadingFinished(event)
- {
- const requestId = event.params.requestId;
- for (const resource of resources) {
- if (resource.requestId !== requestId) {
- continue;
- }
- if ("responseAvailable" in resource) {
- onResponseReady();
- } else {
- InspectorTest.sendCommand("Network.getResponseBody", { "requestId": requestId }, onResponseBody.bind(null, resource));
- }
- }
- }
-
- function onResponseReady()
- {
- resourcesLeft -= 1;
- if (resourcesLeft === 0)
- receivedAllResources();
- }
-
- function onResponseBody(resource, protocolResponse)
- {
- if (protocolResponse.error) {
- resource.responseAvailable = false;
- } else {
- resource.responseAvailable = true;
- resource.responseEncoded = protocolResponse.result.base64Encoded;
- }
- onResponseReady();
- }
-
- function receivedAllResources()
- {
- for (var i = 0; i < resources.length; ++i) {
- var resource = resources[i];
- var description = "Resource " + resource.url + " got type: " + resource.gotType + ", type: " + resource.type + ", responseAvailable: " + resource.responseAvailable;
- if (resource.responseAvailable)
- description += ", responseEncoded: " + resource.responseEncoded;
- InspectorTest.log(description);
- }
- 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>

Powered by Google App Engine
This is Rietveld 408576698