| 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..033e8c20c9f6f4b443c41f37477a9f1e6c7d3c35 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
|
| @@ -6,25 +6,57 @@
|
| 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 testJSONView(request)
|
| {
|
| - var request1 = WebInspector.panel("network").requests[WebInspector.panel("network").requests.length - 1];
|
| - InspectorTest.addResult("resource.content after requesting content: " + request1.content);
|
| + // 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);
|
| + }
|
|
|
| - InspectorTest.completeTest();
|
| + function testType(contentType, callback)
|
| + {
|
| + function step2()
|
| + {
|
| + var request = lastRequest();
|
| + InspectorTest.addResult(request.url);
|
| + InspectorTest.addResult("resource.type: " + request.type);
|
| + InspectorTest.addResult("resource.content before requesting content: " + request.content);
|
| + InspectorTest.assertTrue(!request.failed, "Resource loading failed.");
|
| + request.requestContent(step3);
|
| + }
|
| + function step3()
|
| + {
|
| + var request = lastRequest();
|
| + InspectorTest.addResult("resource.content after requesting content: " + request.content);
|
| + testJSONView(request);
|
| + callback();
|
| + }
|
| + contentType = encodeURIComponent(contentType);
|
| + InspectorTest.makeSimpleXHR("GET", "resources/json.php?type=" + contentType, true, step2);
|
| }
|
| + InspectorTest.runTestSuite([
|
| + function test1(next)
|
| + {
|
| + testType("application/json", next);
|
| + },
|
| + function test2(next)
|
| + {
|
| + testType("application/vnd.document+json", next);
|
| + },
|
| + ]);
|
| }
|
| </script>
|
| </head>
|
|
|