diff options
author | jungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-25 21:42:00 +0000 |
---|---|---|
committer | jungshik@google.com <jungshik@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-25 21:42:00 +0000 |
commit | c9ec45429c64884c35f83b74131c0e3ae5b2bbe9 (patch) | |
tree | 39007373603b8e75f53fa5e4d0c1586b1a3a56b5 /base/json_reader_unittest.cc | |
parent | 7e2fa03804bef4bff9c5bb941f2edf09b6d234c0 (diff) | |
download | chromium_src-c9ec45429c64884c35f83b74131c0e3ae5b2bbe9.zip chromium_src-c9ec45429c64884c35f83b74131c0e3ae5b2bbe9.tar.gz chromium_src-c9ec45429c64884c35f83b74131c0e3ae5b2bbe9.tar.bz2 |
Add UTF-8 check for JSON deserializer.
Add tests for IsStringUTF8
Make IsStringUTF8 accept std::string/std::wstring rather than char*/wchar_t*
Review URL: http://codereview.chromium.org/4268
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2610 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/json_reader_unittest.cc')
-rw-r--r-- | base/json_reader_unittest.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/base/json_reader_unittest.cc b/base/json_reader_unittest.cc index 6c60a07..c2d6a42 100644 --- a/base/json_reader_unittest.cc +++ b/base/json_reader_unittest.cc @@ -481,6 +481,13 @@ TEST(JSONReaderTest, Reading) { 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)); |