| Index: LayoutTests/http/tests/inspector/network/json-preview.html
|
| diff --git a/LayoutTests/http/tests/inspector/network/json-preview.html b/LayoutTests/http/tests/inspector/network/json-preview.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..28aa53de1c8c27a324b18042245ef0e812676dc1
|
| --- /dev/null
|
| +++ b/LayoutTests/http/tests/inspector/network/json-preview.html
|
| @@ -0,0 +1,49 @@
|
| +<html>
|
| +<head>
|
| +<script src="../inspector-test.js"></script>
|
| +<script src="../network-test.js"></script>
|
| +<script>
|
| +function test()
|
| +{
|
| + // force the loading of NetworkPanel code.
|
| + var networkPanel = WebInspector.showPanel("network");
|
| +
|
| + function createNetworkRequestWithJSONMIMEType(type)
|
| + {
|
| + InspectorTest.addResult("Creating a NetworkRequest with type: " + type);
|
| + var request = new WebInspector.NetworkRequest(0, 'http://localhost');
|
| + request.mimeType = type;
|
| + request._content = '{"number": 42}';
|
| + return request;
|
| + }
|
| +
|
| + function testPreviewer(request)
|
| + {
|
| + var previewView = new WebInspector.RequestPreviewView(request, null);
|
| + var previewer = previewView._createPreviewView();
|
| + InspectorTest.addResult("Its previewer is the JSON previewer: " + (previewer && previewer instanceof WebInspector.RequestJSONView));
|
| + }
|
| +
|
| + function testType(contentType, callback)
|
| + {
|
| + var request = createNetworkRequestWithJSONMIMEType(contentType);
|
| + testPreviewer(request);
|
| + callback();
|
| + }
|
| + 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 that resources with JSON MIME types are previewed with the JSON viewer.</p>
|
| +</body>
|
| +</html>
|
|
|