| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 "core/inspector/protocol/Protocol.h" | 5 #include "core/inspector/protocol/Protocol.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| 11 using protocol::parseJSON; | |
| 12 using protocol::DictionaryValue; | 11 using protocol::DictionaryValue; |
| 13 using protocol::ListValue; | 12 using protocol::ListValue; |
| 14 using protocol::Value; | 13 using protocol::Value; |
| 15 | 14 |
| 15 static std::unique_ptr<protocol::Value> parseJSON(const String& string) { |
| 16 return protocol::StringUtil::parseJSON(string); |
| 17 } |
| 18 |
| 16 TEST(ProtocolParserTest, Reading) { | 19 TEST(ProtocolParserTest, Reading) { |
| 17 Value* tmpValue; | 20 Value* tmpValue; |
| 18 std::unique_ptr<Value> root; | 21 std::unique_ptr<Value> root; |
| 19 std::unique_ptr<Value> root2; | 22 std::unique_ptr<Value> root2; |
| 20 String strVal; | 23 String strVal; |
| 21 int intVal = 0; | 24 int intVal = 0; |
| 22 | 25 |
| 23 // some whitespace checking | 26 // some whitespace checking |
| 24 root = parseJSON(" null "); | 27 root = parseJSON(" null "); |
| 25 ASSERT_TRUE(root.get()); | 28 ASSERT_TRUE(root.get()); |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 "/* test *", "{\"foo\"", "{\"foo\":", " [", "\"\\u123g\"", "{\n\"eh:\n}", | 487 "/* test *", "{\"foo\"", "{\"foo\":", " [", "\"\\u123g\"", "{\n\"eh:\n}", |
| 485 "////", "*/**/", "/**/", "/*/", "//**/"}; | 488 "////", "*/**/", "/**/", "/*/", "//**/"}; |
| 486 | 489 |
| 487 for (size_t i = 0; i < 11; ++i) { | 490 for (size_t i = 0; i < 11; ++i) { |
| 488 std::unique_ptr<Value> result = parseJSON(invalidJson[i]); | 491 std::unique_ptr<Value> result = parseJSON(invalidJson[i]); |
| 489 EXPECT_FALSE(result.get()); | 492 EXPECT_FALSE(result.get()); |
| 490 } | 493 } |
| 491 } | 494 } |
| 492 | 495 |
| 493 } // namespace blink | 496 } // namespace blink |
| OLD | NEW |