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

Unified Diff: LayoutTests/http/tests/inspector/network/json-preview.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 side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698