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

Unified Diff: chrome/common/json_value_serializer_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
Index: chrome/common/json_value_serializer_unittest.cc
diff --git a/chrome/common/json_value_serializer_unittest.cc b/chrome/common/json_value_serializer_unittest.cc
index 541ac8c130c5d8e1aa18b01a04f6c040e9a59d78..abb36844acf422cc221fb0636729ee33148b368f 100644
--- a/chrome/common/json_value_serializer_unittest.cc
+++ b/chrome/common/json_value_serializer_unittest.cc
@@ -195,8 +195,9 @@ namespace {
void ValidateJsonList(const std::string& json) {
scoped_ptr<Value> root(base::JSONReader::Read(json, false));
- ASSERT_TRUE(root.get() && root->IsType(Value::TYPE_LIST));
- ListValue* list = static_cast<ListValue*>(root.get());
+ ASSERT_TRUE(root.get());
+ ListValue* list = root->AsList();
+ ASSERT_TRUE(list);
ASSERT_EQ(1U, list->GetSize());
Value* elt = NULL;
ASSERT_TRUE(list->Get(0, &elt));
@@ -219,8 +220,9 @@ TEST(JSONValueSerializerTest, JSONReaderComments) {
// It's ok to have a comment in a string.
root.reset(base::JSONReader::Read("[\"// ok\\n /* foo */ \"]", false));
- ASSERT_TRUE(root.get() && root->IsType(Value::TYPE_LIST));
- ListValue* list = static_cast<ListValue*>(root.get());
+ ASSERT_TRUE(root.get());
+ ListValue* list = root->AsList();
+ ASSERT_TRUE(list);
ASSERT_EQ(1U, list->GetSize());
Value* elt = NULL;
ASSERT_TRUE(list->Get(0, &elt));

Powered by Google App Engine
This is Rietveld 408576698