| 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 #ifndef BASE_JSON_JSON_PARSER_H_ | 5 #ifndef BASE_JSON_JSON_PARSER_H_ |
| 6 #define BASE_JSON_JSON_PARSER_H_ | 6 #define BASE_JSON_JSON_PARSER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" |
| 13 #include "base/json/json_reader.h" | 14 #include "base/json/json_reader.h" |
| 14 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
| 15 | 16 |
| 16 #if !defined(OS_CHROMEOS) | 17 namespace base { |
| 17 #include "base/gtest_prod_util.h" | |
| 18 #endif | |
| 19 | 18 |
| 20 namespace base { | |
| 21 class Value; | 19 class Value; |
| 22 } | |
| 23 | 20 |
| 24 #if defined(OS_CHROMEOS) | |
| 25 // Chromium and Chromium OS check out gtest to different places, so this is | |
| 26 // unable to compile on both if gtest_prod.h is included here. Instead, include | |
| 27 // its only contents -- this will need to be updated if the macro ever changes. | |
| 28 #define FRIEND_TEST(test_case_name, test_name)\ | |
| 29 friend class test_case_name##_##test_name##_Test | |
| 30 | |
| 31 #define FRIEND_TEST_ALL_PREFIXES(test_case_name, test_name) \ | |
| 32 FRIEND_TEST(test_case_name, test_name); \ | |
| 33 FRIEND_TEST(test_case_name, DISABLED_##test_name); \ | |
| 34 FRIEND_TEST(test_case_name, FLAKY_##test_name) | |
| 35 #endif // OS_CHROMEOS | |
| 36 | |
| 37 namespace base { | |
| 38 namespace internal { | 21 namespace internal { |
| 39 | 22 |
| 40 class JSONParserTest; | 23 class JSONParserTest; |
| 41 | 24 |
| 42 // The implementation behind the JSONReader interface. This class is not meant | 25 // The implementation behind the JSONReader interface. This class is not meant |
| 43 // to be used directly; it encapsulates logic that need not be exposed publicly. | 26 // to be used directly; it encapsulates logic that need not be exposed publicly. |
| 44 // | 27 // |
| 45 // This parser guarantees O(n) time through the input string. It also optimizes | 28 // This parser guarantees O(n) time through the input string. It also optimizes |
| 46 // base::StringValue by using StringPiece where possible when returning Value | 29 // base::StringValue by using StringPiece where possible when returning Value |
| 47 // objects by using "hidden roots," discussed in the implementation. | 30 // objects by using "hidden roots," discussed in the implementation. |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ConsumeNumbers); | 245 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ConsumeNumbers); |
| 263 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ErrorMessages); | 246 FRIEND_TEST_ALL_PREFIXES(JSONParserTest, ErrorMessages); |
| 264 | 247 |
| 265 DISALLOW_COPY_AND_ASSIGN(JSONParser); | 248 DISALLOW_COPY_AND_ASSIGN(JSONParser); |
| 266 }; | 249 }; |
| 267 | 250 |
| 268 } // namespace internal | 251 } // namespace internal |
| 269 } // namespace base | 252 } // namespace base |
| 270 | 253 |
| 271 #endif // BASE_JSON_JSON_PARSER_H_ | 254 #endif // BASE_JSON_JSON_PARSER_H_ |
| OLD | NEW |