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

Unified Diff: base/values_unittest.cc

Issue 5213002: Fix for Bug 50726 "Save extension list and "winning" prefs from extensions" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Addressed comments, moved ExtensionPrefStore reference to Profile Created 10 years, 1 month 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: base/values_unittest.cc
diff --git a/base/values_unittest.cc b/base/values_unittest.cc
index 9f34c62fd2a6e3c73f070f86107df5fa3bbd9674..4b1a68c683d12f5e869d501f14267e16fb3c6535 100644
--- a/base/values_unittest.cc
+++ b/base/values_unittest.cc
@@ -508,6 +508,30 @@ TEST_F(ValuesTest, Equals) {
EXPECT_FALSE(dv.Equals(copy.get()));
}
+TEST_F(ValuesTest, StaticEquals) {
+ Value* null_ptr = NULL;
Mattias Nissler (ping if slow) 2010/12/01 10:36:36 Why have a var for this that even has more charact
battre (please use the other) 2010/12/01 17:44:38 Done.
+ scoped_ptr<Value> null1(Value::CreateNullValue());
+ scoped_ptr<Value> null2(Value::CreateNullValue());
+ EXPECT_TRUE(Value::Equals(null1.get(), null2.get()));
+ EXPECT_TRUE(Value::Equals(null_ptr, null_ptr));
+
+ scoped_ptr<Value> i42(Value::CreateIntegerValue(42));
+ scoped_ptr<Value> j42(Value::CreateIntegerValue(42));
+ scoped_ptr<Value> i17(Value::CreateIntegerValue(17));
+ EXPECT_TRUE(Value::Equals(i42.get(), i42.get()));
+ EXPECT_TRUE(Value::Equals(j42.get(), i42.get()));
+ EXPECT_TRUE(Value::Equals(i42.get(), j42.get()));
+ EXPECT_FALSE(Value::Equals(i42.get(), i17.get()));
+ EXPECT_FALSE(Value::Equals(i42.get(), null_ptr));
+ EXPECT_FALSE(Value::Equals(null_ptr, i42.get()));
+
+ // NULL and Value::CreateNullValue() are intentionally different: We need
+ // support for NULL as a return value for "undefined" without caring for
+ // ownership of the pointer.
+ EXPECT_FALSE(Value::Equals(null1.get(), null_ptr));
+ EXPECT_FALSE(Value::Equals(null_ptr, null1.get()));
+}
+
TEST_F(ValuesTest, RemoveEmptyChildren) {
scoped_ptr<DictionaryValue> root(new DictionaryValue);
// Remove empty lists and dictionaries.

Powered by Google App Engine
This is Rietveld 408576698