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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network-fetch-content-with-error-status-code.html

Issue 2848353003: [Devtools] Fixed resource having no content if from xhr blob (Closed)
Patch Set: [Devtools] Fixed resource having no content if from xhr blob Created 3 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 | third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network-fetch-content-with-error-status-code-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network-fetch-content-with-error-status-code.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network-fetch-content-with-error-status-code.html b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network-fetch-content-with-error-status-code.html
new file mode 100644
index 0000000000000000000000000000000000000000..ab3ec3b54922db9d2c89c0fcc8c3f1e756795181
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network-fetch-content-with-error-status-code.html
@@ -0,0 +1,45 @@
+<html>
+<head>
+<script src="../inspector-protocol/inspector-protocol-test.js"></script>
+<script>
+
+async function test() {
+ var requestWillBeSentPromise = InspectorTest.waitForEventPromise('Network.requestWillBeSent');
+ // This url should be cross origin.
+ const url = 'https://127.0.0.1:8443/inspector-protocol/resources/cors-data.php';
+
+ await InspectorTest.sendCommandPromise("Network.enable", {});
+ InspectorTest.log("Network Enabled");
+
+ InspectorTest.evaluateInPage("xhr = new XMLHttpRequest();");
+ InspectorTest.evaluateInPage("xhr.open('GET', '" + url + "', true);");
+ InspectorTest.evaluateInPage("xhr.setRequestHeader('Authorization', '');");
+ InspectorTest.evaluateInPage("xhr.responseType = 'blob';");
+ InspectorTest.evaluateInPage("xhr.send();");
+ InspectorTest.log("Evaled fetch command in page");
+
+ var event = await requestWillBeSentPromise;
+ InspectorTest.log("Request will be sent");
+ InspectorTest.log("Request Method (should be OPTIONS): " + event.params.request.method);
+ InspectorTest.log("Event URL has appropriate ending: " + event.params.request.url.endsWith(url));
+
+ var event = await InspectorTest.waitForEventPromise('Network.requestWillBeSent');
+ InspectorTest.log("Second Response Method (should be GET): " + event.params.request.method);
+ var requestId = event.params.requestId;
+
+
+ var event = await InspectorTest.waitForEventPromise('Network.responseReceived');
+ InspectorTest.log("Got response received");
+ InspectorTest.log("requestId is the same as requestWillBeSent: " + (requestId === event.params.requestId));
+
+ var message = await InspectorTest.sendCommandPromise("Network.getResponseBody", {requestId: requestId});
+ InspectorTest.log("Response Body: " + message.result.body);
+
+ InspectorTest.completeTest();
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Test to make sure if an xhr is fetched with the response as a blob and cross origin devtools can get body.</p>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-protocol/network-fetch-content-with-error-status-code-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698