Chromium Code Reviews| Index: LayoutTests/http/tests/inspector/network/network-preview-json-type.html |
| diff --git a/LayoutTests/http/tests/inspector/network/network-preview-json-type.html b/LayoutTests/http/tests/inspector/network/network-preview-json-type.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f3a870ca9f41966991cb92c00d123d1d2ae7c3f4 |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/inspector/network/network-preview-json-type.html |
| @@ -0,0 +1,73 @@ |
| +<!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
|
| +<html> |
| +<head> |
| +<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); |
| +} |
| + |
| +var test = function() |
| +{ |
| + InspectorTest.recordNetwork(); |
| + var networkPanel = WebInspector.showPanel("network"); |
| + |
| + function lastRequest() |
| + { |
| + return networkPanel.requests[networkPanel.requests.length - 1]; |
| + } |
| + |
| + function testJSONView(request) |
| + { |
| + // Forcedly show the request in the network preview tab. |
| + networkPanel._showRequest(request); |
| + networkPanel.visibleView.selectTab("preview"); |
| + networkPanel.visibleView._currentTab.view.wasShown(); |
| + |
| + var previewView = networkPanel.visibleView._currentTab.view.innerView; |
| + var isJSON = typeof previewView === "object" && previewView instanceof WebInspector.RequestJSONView; |
| + InspectorTest.addResult("The preview tab has a JSON view: " + isJSON); |
| + } |
| + |
| + function testOne(contentType, callback) |
| + { |
| + InspectorTest.addConsoleSniffer(step2); |
| + InspectorTest.evaluateInPage("loadIframe('" + encodeURIComponent(contentType) + "')"); |
| + |
| + function step2() |
| + { |
| + var request = lastRequest(); |
| + InspectorTest.addResult("resource.url: " + request.url); |
| + InspectorTest.addResult("resource.type: " + request.type); |
| + request.requestContent(step3); |
| + } |
| + function step3() |
| + { |
| + var request = lastRequest(); |
| + InspectorTest.addResult("resource.content: " + request.content); |
| + testJSONView(request); |
| + callback(); |
| + } |
| + } |
| + |
| + InspectorTest.runTestSuite([ |
| + function testJSON_1(next) |
| + { |
| + testOne("application/json", next); |
| + }, |
| + function testJSON_2(next) |
| + { |
| + testOne("application/vnd.document+json", next); |
| + }, |
| + ]); |
| +} |
| +</script> |
| +</head> |
| +<body onload="runTest()"> |
| +<p>Tests that application/json content is fetched and previewed as JSON.</p> |
| +</body> |
| +</html> |