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

Unified Diff: base/json_reader_unittest.cc

Issue 4268: IsStringUTF8 unittest and enforcing UTF-8 in JSON deserialization (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 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 | « base/json_reader.cc ('k') | base/string_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json_reader_unittest.cc
===================================================================
--- base/json_reader_unittest.cc (revision 2506)
+++ base/json_reader_unittest.cc (working copy)
@@ -481,6 +481,13 @@
ASSERT_EQ(L"\x7f51\x9875", str_val);
delete root;
+ // Test invalid utf8 encoded input
+ root = NULL;
+ ASSERT_FALSE(JSONReader::JsonToValue("\"345\xb0\xa1\xb0\xa2\"", &root,
+ false, false));
+ ASSERT_FALSE(JSONReader::JsonToValue("\"123\xc0\x81\"", &root,
+ false, false));
+
// Test invalid root objects.
root = NULL;
ASSERT_FALSE(JSONReader::Read("null", &root, false));
« no previous file with comments | « base/json_reader.cc ('k') | base/string_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698