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

Unified Diff: LayoutTests/http/tests/inspector/network/async-xhr-json-mime-type.html

Issue 94893003: Support for json media types as (non-image) mime types. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test via synthetic NetworkRequest Created 7 years 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/http/tests/inspector/network/async-xhr-json-mime-type-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/inspector/network/async-xhr-json-mime-type.html
diff --git a/LayoutTests/http/tests/inspector/network/async-xhr-json-mime-type.html b/LayoutTests/http/tests/inspector/network/async-xhr-json-mime-type.html
index 1caa9573111deb667bf97eb65269b885e6ef44d6..124e7ffec7f9c393978b109ad7f85792a139ac3e 100644
--- a/LayoutTests/http/tests/inspector/network/async-xhr-json-mime-type.html
+++ b/LayoutTests/http/tests/inspector/network/async-xhr-json-mime-type.html
@@ -3,35 +3,80 @@
<script src="../inspector-test.js"></script>
<script src="../network-test.js"></script>
<script>
+function loadIframe(contentType)
+{
+ iframe = document.createElement("iframe");
+ iframe.src = "resources/json.php?type=" + contentType;
+ document.body.appendChild(iframe);
+}
+
function test()
{
InspectorTest.recordNetwork();
- InspectorTest.makeSimpleXHR("GET", "resources/json.php", true, step2);
- function step2()
+ var networkPanel = WebInspector.showPanel("network");
+
+ function lastRequest()
{
- var request1 = WebInspector.panel("network").requests[WebInspector.panel("network").requests.length - 1];
- InspectorTest.addResult(request1.url);
- InspectorTest.addResult("resource.type: " + request1.type);
- InspectorTest.addResult("resource.content before requesting content: " + request1.content);
- InspectorTest.assertTrue(!request1.failed, "Resource loading failed.");
- request1.requestContent(step3);
+ return networkPanel.requests[networkPanel.requests.length - 1];
}
- function step3()
+ function reportRequest(request)
{
- var request1 = WebInspector.panel("network").requests[WebInspector.panel("network").requests.length - 1];
- InspectorTest.addResult("resource.content after requesting content: " + request1.content);
+ InspectorTest.addResult("request.url: " + request.url);
+ InspectorTest.addResult("request.type: " + request.type);
+ InspectorTest.addResult("request.mimeType: " + request.mimeType);
+ }
+
+ function testType(contentType, callback)
+ {
+ var encodedContentType = encodeURIComponent(contentType);
+ function step2()
+ {
+ var request = lastRequest();
+ reportRequest(request)
+ request.requestContent(step3);
+ }
+ function step3()
+ {
+ var request = lastRequest();
+ InspectorTest.addResult("request.content: " + request.content);
+
+ InspectorTest.addConsoleSniffer(step4);
+ InspectorTest.evaluateInPage("loadIframe('" + encodedContentType + "')");
+ }
+ function step4()
+ {
+ var request = lastRequest();
+ reportRequest(request);
+ request.requestContent(step5);
+ }
+ function step5()
+ {
+ var request = lastRequest();
+ InspectorTest.addResult("request.content: " + request.content);
- InspectorTest.completeTest();
+ callback();
+ }
+ InspectorTest.makeSimpleXHR("GET", "resources/json.php?type=" + encodedContentType, true, step2);
}
+ InspectorTest.runTestSuite([
+ function test1(next)
+ {
+ testType("application/json", next);
+ },
+ function test2(next)
+ {
+ testType("application/vnd.document+json", next);
+ },
+ ]);
}
</script>
</head>
<body onload="runTest()">
- <p>
- Tests XHR network resource content for asynchronous requests with application/json mime type.
-<a href="https://bugs.webkit.org/show_bug.cgi?id=80684">Bug 80684</a>
+<p>
+ Tests that the content of resources with JSON MIME types can be accessed.<br/>
+ When loaded by asynchronous XHR requests (<a href="https://bugs.webkit.org/show_bug.cgi?id=80684">Bug 80684</a>) or within iframes/documents.
</p>
</body>
</html>
« no previous file with comments | « no previous file | LayoutTests/http/tests/inspector/network/async-xhr-json-mime-type-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698