| 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 "platform/inspector_protocol/Parser.h" | 5 #include "platform/inspector_protocol/Parser.h" |
| 6 | 6 |
| 7 #include "platform/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
| 8 #include "platform/inspector_protocol/Values.h" | 8 #include "platform/inspector_protocol/Values.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 namespace protocol { | 12 namespace protocol { |
| 13 | 13 |
| 14 TEST(ParserTest, Reading) | 14 TEST(ParserTest, Reading) |
| 15 { | 15 { |
| 16 protocol::Value* tmpValue; | 16 protocol::Value* tmpValue; |
| 17 OwnPtr<protocol::Value> root; | 17 std::unique_ptr<protocol::Value> root; |
| 18 OwnPtr<protocol::Value> root2; | 18 std::unique_ptr<protocol::Value> root2; |
| 19 String16 strVal; | 19 String16 strVal; |
| 20 int intVal = 0; | 20 int intVal = 0; |
| 21 | 21 |
| 22 // some whitespace checking | 22 // some whitespace checking |
| 23 root = parseJSON(" null "); | 23 root = parseJSON(" null "); |
| 24 ASSERT_TRUE(root.get()); | 24 ASSERT_TRUE(root.get()); |
| 25 EXPECT_EQ(Value::TypeNull, root->type()); | 25 EXPECT_EQ(Value::TypeNull, root->type()); |
| 26 | 26 |
| 27 // Invalid JSON string | 27 // Invalid JSON string |
| 28 root = parseJSON("nu"); | 28 root = parseJSON("nu"); |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 "\"\\u123g\"", | 488 "\"\\u123g\"", |
| 489 "{\n\"eh:\n}", | 489 "{\n\"eh:\n}", |
| 490 "////", | 490 "////", |
| 491 "*/**/", | 491 "*/**/", |
| 492 "/**/", | 492 "/**/", |
| 493 "/*/", | 493 "/*/", |
| 494 "//**/" | 494 "//**/" |
| 495 }; | 495 }; |
| 496 | 496 |
| 497 for (size_t i = 0; i < 11; ++i) { | 497 for (size_t i = 0; i < 11; ++i) { |
| 498 OwnPtr<protocol::Value> result = parseJSON(invalidJson[i]); | 498 std::unique_ptr<protocol::Value> result = parseJSON(invalidJson[i]); |
| 499 EXPECT_FALSE(result.get()); | 499 EXPECT_FALSE(result.get()); |
| 500 } | 500 } |
| 501 } | 501 } |
| 502 | 502 |
| 503 } // namespace protocol | 503 } // namespace protocol |
| 504 } // namespace blink | 504 } // namespace blink |
| OLD | NEW |