OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../inspector-test.js"></script> |
| 4 <script src="../network-test.js"></script> |
| 5 <script> |
| 6 function test() |
| 7 { |
| 8 // force the loading of NetworkPanel code. |
| 9 var networkPanel = WebInspector.showPanel("network"); |
| 10 |
| 11 function createNetworkRequestWithJSONMIMEType(type) |
| 12 { |
| 13 InspectorTest.addResult("Creating a NetworkRequest with type: " + type); |
| 14 var request = new WebInspector.NetworkRequest(0, 'http://localhost'); |
| 15 request.mimeType = type; |
| 16 request._content = '{"number": 42}'; |
| 17 return request; |
| 18 } |
| 19 |
| 20 function testPreviewer(request) |
| 21 { |
| 22 var previewView = new WebInspector.RequestPreviewView(request, null); |
| 23 var previewer = previewView._createPreviewView(); |
| 24 InspectorTest.addResult("Its previewer is the JSON previewer: " + (previ
ewer && previewer instanceof WebInspector.RequestJSONView)); |
| 25 } |
| 26 |
| 27 function testType(contentType, callback) |
| 28 { |
| 29 var request = createNetworkRequestWithJSONMIMEType(contentType); |
| 30 testPreviewer(request); |
| 31 callback(); |
| 32 } |
| 33 InspectorTest.runTestSuite([ |
| 34 function test1(next) |
| 35 { |
| 36 testType("application/json", next); |
| 37 }, |
| 38 function test2(next) |
| 39 { |
| 40 testType("application/vnd.document+json", next); |
| 41 }, |
| 42 ]); |
| 43 } |
| 44 </script> |
| 45 </head> |
| 46 <body onload="runTest()"> |
| 47 <p>Tests that resources with JSON MIME types are previewed with the JSON viewer.
</p> |
| 48 </body> |
| 49 </html> |
OLD | NEW |