| 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 |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 EXPECT_EQ("str", strVal); | 325 EXPECT_EQ("str", strVal); |
| 326 | 326 |
| 327 // Test newline equivalence. | 327 // Test newline equivalence. |
| 328 root2 = parseJSON( | 328 root2 = parseJSON( |
| 329 "{\n" | 329 "{\n" |
| 330 " \"number\":9.87654321,\n" | 330 " \"number\":9.87654321,\n" |
| 331 " \"null\":null,\n" | 331 " \"null\":null,\n" |
| 332 " \"S\":\"str\"\n" | 332 " \"S\":\"str\"\n" |
| 333 "}\n"); | 333 "}\n"); |
| 334 ASSERT_TRUE(root2.get()); | 334 ASSERT_TRUE(root2.get()); |
| 335 EXPECT_EQ(root->toJSONString(), root2->toJSONString()); | 335 EXPECT_EQ(root->serialize(), root2->serialize()); |
| 336 | 336 |
| 337 root2 = parseJSON( | 337 root2 = parseJSON( |
| 338 "{\r\n" | 338 "{\r\n" |
| 339 " \"number\":9.87654321,\r\n" | 339 " \"number\":9.87654321,\r\n" |
| 340 " \"null\":null,\r\n" | 340 " \"null\":null,\r\n" |
| 341 " \"S\":\"str\"\r\n" | 341 " \"S\":\"str\"\r\n" |
| 342 "}\r\n"); | 342 "}\r\n"); |
| 343 ASSERT_TRUE(root2.get()); | 343 ASSERT_TRUE(root2.get()); |
| 344 EXPECT_EQ(root->toJSONString(), root2->toJSONString()); | 344 EXPECT_EQ(root->serialize(), root2->serialize()); |
| 345 | 345 |
| 346 // Test nesting | 346 // Test nesting |
| 347 root = parseJSON("{\"inner\":{\"array\":[true]},\"false\":false,\"d\":{}}"); | 347 root = parseJSON("{\"inner\":{\"array\":[true]},\"false\":false,\"d\":{}}"); |
| 348 ASSERT_TRUE(root.get()); | 348 ASSERT_TRUE(root.get()); |
| 349 EXPECT_EQ(Value::TypeObject, root->type()); | 349 EXPECT_EQ(Value::TypeObject, root->type()); |
| 350 objectVal = DictionaryValue::cast(root.get()); | 350 objectVal = DictionaryValue::cast(root.get()); |
| 351 ASSERT_TRUE(objectVal); | 351 ASSERT_TRUE(objectVal); |
| 352 DictionaryValue* innerObject = objectVal->getObject("inner"); | 352 DictionaryValue* innerObject = objectVal->getObject("inner"); |
| 353 ASSERT_TRUE(innerObject); | 353 ASSERT_TRUE(innerObject); |
| 354 ListValue* innerArray = innerObject->getArray("array"); | 354 ListValue* innerArray = innerObject->getArray("array"); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 "/* test *", "{\"foo\"", "{\"foo\":", " [", "\"\\u123g\"", "{\n\"eh:\n}", | 487 "/* test *", "{\"foo\"", "{\"foo\":", " [", "\"\\u123g\"", "{\n\"eh:\n}", |
| 488 "////", "*/**/", "/**/", "/*/", "//**/"}; | 488 "////", "*/**/", "/**/", "/*/", "//**/"}; |
| 489 | 489 |
| 490 for (size_t i = 0; i < 11; ++i) { | 490 for (size_t i = 0; i < 11; ++i) { |
| 491 std::unique_ptr<Value> result = parseJSON(invalidJson[i]); | 491 std::unique_ptr<Value> result = parseJSON(invalidJson[i]); |
| 492 EXPECT_FALSE(result.get()); | 492 EXPECT_FALSE(result.get()); |
| 493 } | 493 } |
| 494 } | 494 } |
| 495 | 495 |
| 496 } // namespace blink | 496 } // namespace blink |
| OLD | NEW |