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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../inspector-test.js"></script> 3 <script src="../inspector-test.js"></script>
4 <script src="../network-test.js"></script> 4 <script src="../network-test.js"></script>
5 <script> 5 <script>
6 function loadIframe(contentType)
7 {
8 iframe = document.createElement("iframe");
9 iframe.src = "resources/json.php?type=" + contentType;
10 document.body.appendChild(iframe);
11 }
12
6 function test() 13 function test()
7 { 14 {
8 InspectorTest.recordNetwork(); 15 InspectorTest.recordNetwork();
9 InspectorTest.makeSimpleXHR("GET", "resources/json.php", true, step2);
10 16
11 function step2() 17 var networkPanel = WebInspector.showPanel("network");
18
19 function lastRequest()
12 { 20 {
13 var request1 = WebInspector.panel("network").requests[WebInspector.panel ("network").requests.length - 1]; 21 return networkPanel.requests[networkPanel.requests.length - 1];
14 InspectorTest.addResult(request1.url);
15 InspectorTest.addResult("resource.type: " + request1.type);
16 InspectorTest.addResult("resource.content before requesting content: " + request1.content);
17 InspectorTest.assertTrue(!request1.failed, "Resource loading failed.");
18 request1.requestContent(step3);
19 } 22 }
20 23
21 function step3() 24 function reportRequest(request)
22 { 25 {
23 var request1 = WebInspector.panel("network").requests[WebInspector.panel ("network").requests.length - 1]; 26 InspectorTest.addResult("request.url: " + request.url);
24 InspectorTest.addResult("resource.content after requesting content: " + request1.content); 27 InspectorTest.addResult("request.type: " + request.type);
28 InspectorTest.addResult("request.mimeType: " + request.mimeType);
29 }
25 30
26 InspectorTest.completeTest(); 31 function testType(contentType, callback)
32 {
33 var encodedContentType = encodeURIComponent(contentType);
34 function step2()
35 {
36 var request = lastRequest();
37 reportRequest(request)
38 request.requestContent(step3);
39 }
40 function step3()
41 {
42 var request = lastRequest();
43 InspectorTest.addResult("request.content: " + request.content);
44
45 InspectorTest.addConsoleSniffer(step4);
46 InspectorTest.evaluateInPage("loadIframe('" + encodedContentType + " ')");
47 }
48 function step4()
49 {
50 var request = lastRequest();
51 reportRequest(request);
52 request.requestContent(step5);
53 }
54 function step5()
55 {
56 var request = lastRequest();
57 InspectorTest.addResult("request.content: " + request.content);
58
59 callback();
60 }
61 InspectorTest.makeSimpleXHR("GET", "resources/json.php?type=" + encodedC ontentType, true, step2);
27 } 62 }
63 InspectorTest.runTestSuite([
64 function test1(next)
65 {
66 testType("application/json", next);
67 },
68 function test2(next)
69 {
70 testType("application/vnd.document+json", next);
71 },
72 ]);
28 } 73 }
29 </script> 74 </script>
30 </head> 75 </head>
31 <body onload="runTest()"> 76 <body onload="runTest()">
32 <p> 77 <p>
33 Tests XHR network resource content for asynchronous requests with application/j son mime type. 78 Tests that the content of resources with JSON MIME types can be accessed.<br/>
34 <a href="https://bugs.webkit.org/show_bug.cgi?id=80684">Bug 80684</a> 79 When loaded by asynchronous XHR requests (<a href="https://bugs.webkit.org/show _bug.cgi?id=80684">Bug 80684</a>) or within iframes/documents.
35 </p> 80 </p>
36 </body> 81 </body>
37 </html> 82 </html>
OLDNEW
« 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