Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2197)

Unified Diff: base/json/json_reader_unittest.cc

Issue 7714004: base: Add AsList() function to Value API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: convert one more case in extension_webrequest_api_unittest.cc Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/values.h » ('j') | chrome/browser/extensions/extension_bookmarks_module.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_reader_unittest.cc
diff --git a/base/json/json_reader_unittest.cc b/base/json/json_reader_unittest.cc
index a7aeaf0f5569fb7ca776af264d2a4eb2d99f97f2..7623a68a9f730ffeb65117195deae12cd1dd1968 100644
--- a/base/json/json_reader_unittest.cc
+++ b/base/json/json_reader_unittest.cc
@@ -222,8 +222,8 @@ TEST(JSONReaderTest, Reading) {
// Basic array
root.reset(JSONReader::Read("[true, false, null]", false));
ASSERT_TRUE(root.get());
- ASSERT_TRUE(root->IsType(Value::TYPE_LIST));
- ListValue* list = static_cast<ListValue*>(root.get());
+ ListValue* list = root->AsList();
+ ASSERT_TRUE(list);
ASSERT_EQ(3U, list->GetSize());
// Test with trailing comma. Should be parsed the same as above.
@@ -234,16 +234,16 @@ TEST(JSONReaderTest, Reading) {
// Empty array
root.reset(JSONReader::Read("[]", false));
ASSERT_TRUE(root.get());
- ASSERT_TRUE(root->IsType(Value::TYPE_LIST));
- list = static_cast<ListValue*>(root.get());
+ list = root->AsList();
+ ASSERT_TRUE(list);
ASSERT_EQ(0U, list->GetSize());
// Nested arrays
root.reset(JSONReader::Read("[[true], [], [false, [], [null]], null]",
false));
ASSERT_TRUE(root.get());
- ASSERT_TRUE(root->IsType(Value::TYPE_LIST));
- list = static_cast<ListValue*>(root.get());
+ list = root->AsList();
+ ASSERT_TRUE(list);
ASSERT_EQ(4U, list->GetSize());
// Lots of trailing commas.
@@ -272,8 +272,8 @@ TEST(JSONReaderTest, Reading) {
// Valid if we set |allow_trailing_comma| to true.
root.reset(JSONReader::Read("[true,]", true));
ASSERT_TRUE(root.get());
- ASSERT_TRUE(root->IsType(Value::TYPE_LIST));
- list = static_cast<ListValue*>(root.get());
+ list = root->AsList();
+ ASSERT_TRUE(list);
EXPECT_EQ(1U, list->GetSize());
Value* tmp_value = NULL;
ASSERT_TRUE(list->Get(0, &tmp_value));
@@ -435,8 +435,8 @@ TEST(JSONReaderTest, Reading) {
not_evil.append("[]]");
root.reset(JSONReader::Read(not_evil, false));
ASSERT_TRUE(root.get());
- ASSERT_TRUE(root->IsType(Value::TYPE_LIST));
- list = static_cast<ListValue*>(root.get());
+ list = root->AsList();
+ ASSERT_TRUE(list);
ASSERT_EQ(5001U, list->GetSize());
// Test utf8 encoded input
« no previous file with comments | « no previous file | base/values.h » ('j') | chrome/browser/extensions/extension_bookmarks_module.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698