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

Side by Side Diff: LayoutTests/http/tests/inspector/network/network-preview-json-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: Added DOMImplementation::isJSONMIMEType() and use it to resolve default encodings 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
OLDNEW
(Empty)
1 <!doctype html>
pfeldman 2013/12/05 17:18:53 I don't think you need this test since json-mime-t
sof 2013/12/05 19:32:44 Aren't there different code paths (and internal ha
pfeldman 2013/12/06 11:12:29 I am not sure I follow. It seems like this test is
sof 2013/12/06 11:34:59 InspectorPageAgent.cpp:createXHRTextDecoder() vs N
2 <html>
3 <head>
4 <script src="../inspector-test.js"></script>
5 <script src="../network-test.js"></script>
6 <script>
7 function loadIframe(contentType)
8 {
9 iframe = document.createElement("iframe");
10 iframe.src = "resources/json.php?type=" + contentType;
11 document.body.appendChild(iframe);
12 }
13
14 var test = function()
15 {
16 InspectorTest.recordNetwork();
17 var networkPanel = WebInspector.showPanel("network");
18
19 function lastRequest()
20 {
21 return networkPanel.requests[networkPanel.requests.length - 1];
22 }
23
24 function testJSONView(request)
25 {
26 // Forcedly show the request in the network preview tab.
27 networkPanel._showRequest(request);
28 networkPanel.visibleView.selectTab("preview");
29 networkPanel.visibleView._currentTab.view.wasShown();
30
31 var previewView = networkPanel.visibleView._currentTab.view.innerView;
32 var isJSON = typeof previewView === "object" && previewView instanceof W ebInspector.RequestJSONView;
33 InspectorTest.addResult("The preview tab has a JSON view: " + isJSON);
34 }
35
36 function testOne(contentType, callback)
37 {
38 InspectorTest.addConsoleSniffer(step2);
39 InspectorTest.evaluateInPage("loadIframe('" + encodeURIComponent(content Type) + "')");
40
41 function step2()
42 {
43 var request = lastRequest();
44 InspectorTest.addResult("resource.url: " + request.url);
45 InspectorTest.addResult("resource.type: " + request.type);
46 request.requestContent(step3);
47 }
48 function step3()
49 {
50 var request = lastRequest();
51 InspectorTest.addResult("resource.content: " + request.content);
52 testJSONView(request);
53 callback();
54 }
55 }
56
57 InspectorTest.runTestSuite([
58 function testJSON_1(next)
59 {
60 testOne("application/json", next);
61 },
62 function testJSON_2(next)
63 {
64 testOne("application/vnd.document+json", next);
65 },
66 ]);
67 }
68 </script>
69 </head>
70 <body onload="runTest()">
71 <p>Tests that application/json content is fetched and previewed as JSON.</p>
72 </body>
73 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698