OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/json/json_parser.h" | 5 #include "base/json/json_parser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 316 } |
317 | 317 |
318 TEST_F(JSONParserTest, DecodeUnicodeNonCharacter) { | 318 TEST_F(JSONParserTest, DecodeUnicodeNonCharacter) { |
319 // Tests Unicode code points (encoded as escaped UTF-16) that are not valid | 319 // Tests Unicode code points (encoded as escaped UTF-16) that are not valid |
320 // characters. | 320 // characters. |
321 EXPECT_FALSE(JSONReader::Read("[\"\\ufdd0\"]")); | 321 EXPECT_FALSE(JSONReader::Read("[\"\\ufdd0\"]")); |
322 EXPECT_FALSE(JSONReader::Read("[\"\\ufffe\"]")); | 322 EXPECT_FALSE(JSONReader::Read("[\"\\ufffe\"]")); |
323 EXPECT_FALSE(JSONReader::Read("[\"\\ud83f\\udffe\"]")); | 323 EXPECT_FALSE(JSONReader::Read("[\"\\ud83f\\udffe\"]")); |
324 } | 324 } |
325 | 325 |
| 326 TEST_F(JSONParserTest, DecodeNegativeEscapeSequence) { |
| 327 EXPECT_FALSE(JSONReader::Read("[\"\\x-A\"]")); |
| 328 EXPECT_FALSE(JSONReader::Read("[\"\\u-00A\"]")); |
| 329 } |
| 330 |
326 } // namespace internal | 331 } // namespace internal |
327 } // namespace base | 332 } // namespace base |
OLD | NEW |