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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/network/json-preview.html

Issue 1912973002: [DevTools] JSONView parsing smarter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/network/network-preview-json.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../inspector-test.js"></script> 3 <script src="../inspector-test.js"></script>
4 <script src="../network-test.js"></script> 4 <script src="../network-test.js"></script>
5 <script> 5 <script>
6 function test() 6 function test()
7 { 7 {
8 function createNetworkRequestWithJSONMIMEType(type) 8 function createNetworkRequestWithJSONMIMEType(type)
9 { 9 {
10 InspectorTest.addResult("Creating a NetworkRequest with type: " + type); 10 InspectorTest.addResult("Creating a NetworkRequest with type: " + type);
11 var request = new WebInspector.NetworkRequest(WebInspector.targetManager .mainTarget(), 0, 'http://localhost'); 11 var request = new WebInspector.NetworkRequest(WebInspector.targetManager .mainTarget(), 0, 'http://localhost');
12 request.mimeType = type; 12 request.mimeType = type;
13 request._content = '{"number": 42}'; 13 request._content = '{"number": 42}';
14 return request; 14 return request;
15 } 15 }
16 16
17 function testPreviewer(request) 17 function testPreviewer(request)
18 { 18 {
19 var previewView = new WebInspector.RequestPreviewView(request, null); 19 return new Promise(function(done) {
20 var previewer = previewView._createPreviewView(); 20 var previewView = new WebInspector.RequestPreviewView(request, null) ;
21 InspectorTest.addResult("Its previewer is the JSON previewer: " + (previ ewer && previewer instanceof WebInspector.JSONView)); 21
22 previewView._createPreviewView(function(previewer) {
23 InspectorTest.addResult("Its previewer is the JSON previewer: " + (previewer && previewer instanceof WebInspector.JSONView));
24 done();
25 });
26 });
22 } 27 }
23 28
24 function testType(contentType, callback) 29 function testType(contentType, callback)
25 { 30 {
26 var request = createNetworkRequestWithJSONMIMEType(contentType); 31 var request = createNetworkRequestWithJSONMIMEType(contentType);
27 testPreviewer(request); 32 testPreviewer(request).then(callback);
28 callback();
29 } 33 }
30 InspectorTest.runTestSuite([ 34 InspectorTest.runTestSuite([
31 function test1(next) 35 function test1(next)
32 { 36 {
33 testType("application/json", next); 37 testType("application/json", next);
34 }, 38 },
35 function test2(next) 39 function test2(next)
36 { 40 {
37 testType("application/vnd.document+json", next); 41 testType("application/vnd.document+json", next);
38 }, 42 },
39 ]); 43 ]);
40 } 44 }
41 </script> 45 </script>
42 </head> 46 </head>
43 <body onload="runTest()"> 47 <body onload="runTest()">
44 <p>Tests that resources with JSON MIME types are previewed with the JSON viewer. </p> 48 <p>Tests that resources with JSON MIME types are previewed with the JSON viewer. </p>
45 </body> 49 </body>
46 </html> 50 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector/network/network-preview-json.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698