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

Unified Diff: LayoutTests/http/tests/inspector/network/network-preview-json.html

Issue 654083006: DevTools: NetworkPanel: use optimistic JSON parser for response preview. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/inspector/network/network-preview-json-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/inspector/network/network-preview-json.html
diff --git a/LayoutTests/http/tests/inspector/network/network-preview-json.html b/LayoutTests/http/tests/inspector/network/network-preview-json.html
index d3167da54ac5905693ffbb7d3bfa2c444a90488d..29fb5c0ee995753a47fbecddc654663112d2b48c 100644
--- a/LayoutTests/http/tests/inspector/network/network-preview-json.html
+++ b/LayoutTests/http/tests/inspector/network/network-preview-json.html
@@ -6,43 +6,27 @@
function test()
{
- var testData;
-
- testData = "while(1);";
- InspectorTest.assertTrue(!WebInspector.RequestJSONView.parseJSON(testData), "Should not be able to parse \"" + testData + "\".");
-
- testData = "{\"name\": \"value\"";
- InspectorTest.assertTrue(!WebInspector.RequestJSONView.parseJSON(testData), "Should not be able to parse \"" + testData + "\".");
-
- testData = "{\"name\": \"value\"}";
- var parsedJSON = WebInspector.RequestJSONView.parseJSON(testData);
- InspectorTest.assertEquals(parsedJSON.prefix, "");
- InspectorTest.assertEquals(parsedJSON.data.name, "value");
- InspectorTest.assertEquals(parsedJSON.suffix, "");
-
- testData = "while(1); {\"name\": \"value\"}";
- parsedJSON = WebInspector.RequestJSONView.parseJSON(testData);
- InspectorTest.assertEquals(parsedJSON.prefix, "while(1); ");
- InspectorTest.assertEquals(parsedJSON.data.name, "value");
- InspectorTest.assertEquals(parsedJSON.suffix, "");
-
- testData = "func({)";
- InspectorTest.assertTrue(!WebInspector.RequestJSONView.parseJSONP(testData), "Should not be able to parse \"" + testData + "\".");
-
- testData = "func){(";
- InspectorTest.assertTrue(!WebInspector.RequestJSONView.parseJSONP(testData), "Should not be able to parse \"" + testData + "\".");
-
- testData = "func({\"name\": \"value\"}";
- InspectorTest.assertTrue(!WebInspector.RequestJSONView.parseJSONP(testData), "Should not be able to parse \"" + testData + "\".");
-
- testData = "func{\"name\": \"value\"})";
- InspectorTest.assertTrue(!WebInspector.RequestJSONView.parseJSONP(testData), "Should not be able to parse \"" + testData + "\".");
-
- testData = "func({\"name\": \"value\"})";
- var parsedJSONP = WebInspector.RequestJSONView.parseJSONP(testData);
- InspectorTest.assertEquals(parsedJSONP.prefix, "func(");
- InspectorTest.assertEquals(parsedJSONP.data.name, "value");
- InspectorTest.assertEquals(parsedJSONP.suffix, ")");
+ function check(text) {
+ InspectorTest.addResult("");
+ InspectorTest.addResult("Input: " + text);
+ var parsedJSON = WebInspector.RequestJSONView.parseJSON(text);
+ if (!parsedJSON) {
+ InspectorTest.addResult("Can't parse");
+ return;
+ }
+ InspectorTest.addResult("Prefix: " + parsedJSON.prefix);
+ InspectorTest.addResult("Data: " + JSON.stringify(parsedJSON.data));
+ InspectorTest.addResult("Suffix: " + parsedJSON.suffix);
+ }
+
+ check("{\"name\": \"value\"}");
+ check("while(1); {\"name\": \"value\"}");
+ check("[,\"foo\", -4.2, true, false, null]");
+ check("[{\"foo\": {}, \"bar\": []},[[],{}]]");
+ check("/* vanilla */ run([1, 2, 3]);");
+ check("[\"A\\\"B\\u0020C\\nD\\\\E\\u04ABF\"]");
+
+ check("<html>404 Page not found</html>");
InspectorTest.completeTest();
}
« no previous file with comments | « no previous file | LayoutTests/http/tests/inspector/network/network-preview-json-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698