| 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>
|
|
|