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

Unified Diff: base/values_unittest.cc

Issue 7892052: Adds Find method to the ListValue class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplified the code a bit. Created 9 years, 3 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 | « base/values.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values_unittest.cc
diff --git a/base/values_unittest.cc b/base/values_unittest.cc
index 553e8e15080a083712232ee45b21b077e6fb99de..458a4e1b462641ef930393aecf8622bf62a30bb0 100644
--- a/base/values_unittest.cc
+++ b/base/values_unittest.cc
@@ -93,6 +93,15 @@ TEST(ValuesTest, List) {
ASSERT_EQ(88.8, double_value);
ASSERT_TRUE(mixed_list->GetString(3, &string_value));
ASSERT_EQ("foo", string_value);
+
+ // Try searching in the mixed list.
+ scoped_ptr<Value> sought_value(Value::CreateIntegerValue(42));
+ scoped_ptr<Value> not_found_value(Value::CreateBooleanValue(false));
+
+ ASSERT_NE(mixed_list->end(), mixed_list->Find(*sought_value));
+ ASSERT_TRUE((*mixed_list->Find(*sought_value))->GetAsInteger(&int_value));
+ ASSERT_EQ(42, int_value);
+ ASSERT_EQ(mixed_list->end(), mixed_list->Find(*not_found_value));
}
TEST(ValuesTest, BinaryValue) {
« no previous file with comments | « base/values.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698