Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / network / network-json-parser.html
blob37184bdb1bd063a3aae76fb896ba44c98b363cc0
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/network-test.js"></script>
5 <script>
6 function test() {
7 function check(jsonText)
9 var result = WebInspector.RequestJSONView.parseJSON(jsonText);
10 InspectorTest.addResult("");
11 InspectorTest.addResult("Input: " + jsonText);
12 if (!result) {
13 InspectorTest.addResult("Invalid JSON");
14 } else {
15 InspectorTest.addResult("Prefix: " + result.prefix);
16 InspectorTest.addResult("Suffix: " + result.suffix);
17 InspectorTest.addResult("Data: " + JSON.stringify(result.data));
21 check("plain text");
22 check("{\"x\": 5, \"y\": false, \"z\":\"foo\"}");
23 check("{\"bar\": [,,,1, 2, 3,,,], \"baz\": {\"data\": []}}");
24 check("[[],[],[]]");
25 check("/* GUARD */callback({\"a\": []]});");
26 check("foo({a = 5});");
27 check("(function(){return {\"a\": []}})()");
29 InspectorTest.completeTest();
32 </script>
33 </head>
34 <body onload="runTest()">
35 <p>Tests JSON parsing.</p>
36 </body>
37 </html>