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

Unified Diff: base/values_unittest.cc

Issue 7647026: base: Add three helper functions to Values API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a typo Ceate -> Create 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 | « base/values.cc ('k') | chrome/browser/automation/automation_provider_observers.cc » ('j') | 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..4c1bbe1283da5ca19ae8f43ed884e9ae11cb4c96 100644
--- a/base/values_unittest.cc
+++ b/base/values_unittest.cc
@@ -20,7 +20,7 @@ TEST(ValuesTest, Basic) {
ASSERT_EQ(std::string("http://google.com"), homepage);
ASSERT_FALSE(settings.Get("global", NULL));
- settings.Set("global", Value::CreateBooleanValue(true));
+ settings.Set("global", TrueValue());
ASSERT_TRUE(settings.Get("global", NULL));
settings.SetString("global.homepage", "http://scurvy.com");
ASSERT_TRUE(settings.Get("global", NULL));
@@ -57,7 +57,7 @@ TEST(ValuesTest, Basic) {
TEST(ValuesTest, List) {
scoped_ptr<ListValue> mixed_list(new ListValue());
- mixed_list->Set(0, Value::CreateBooleanValue(true));
+ mixed_list->Set(0, TrueValue());
mixed_list->Set(1, Value::CreateIntegerValue(42));
mixed_list->Set(2, Value::CreateDoubleValue(88.8));
mixed_list->Set(3, Value::CreateStringValue("foo"));
@@ -196,7 +196,7 @@ TEST(ValuesTest, ListDeletion) {
ListValue list;
list.Append(new DeletionTestValue(&deletion_flag));
EXPECT_FALSE(deletion_flag);
- EXPECT_TRUE(list.Set(0, Value::CreateNullValue()));
+ EXPECT_TRUE(list.Set(0, NullValue()));
EXPECT_TRUE(deletion_flag);
}
}
@@ -267,7 +267,7 @@ TEST(ValuesTest, DictionaryDeletion) {
DictionaryValue dict;
dict.Set(key, new DeletionTestValue(&deletion_flag));
EXPECT_FALSE(deletion_flag);
- dict.Set(key, Value::CreateNullValue());
+ dict.Set(key, NullValue());
EXPECT_TRUE(deletion_flag);
}
}
@@ -305,8 +305,8 @@ TEST(ValuesTest, DictionaryRemoval) {
TEST(ValuesTest, DictionaryWithoutPathExpansion) {
DictionaryValue dict;
- dict.Set("this.is.expanded", Value::CreateNullValue());
- dict.SetWithoutPathExpansion("this.isnt.expanded", Value::CreateNullValue());
+ dict.Set("this.is.expanded", NullValue());
+ dict.SetWithoutPathExpansion("this.isnt.expanded", NullValue());
EXPECT_FALSE(dict.HasKey("this.is.expanded"));
EXPECT_TRUE(dict.HasKey("this"));
@@ -327,9 +327,9 @@ TEST(ValuesTest, DictionaryWithoutPathExpansion) {
TEST(ValuesTest, DeepCopy) {
DictionaryValue original_dict;
- Value* original_null = Value::CreateNullValue();
+ Value* original_null = NullValue();
original_dict.Set("null", original_null);
- FundamentalValue* original_bool = Value::CreateBooleanValue(true);
+ FundamentalValue* original_bool = TrueValue();
original_dict.Set("bool", original_bool);
FundamentalValue* original_int = Value::CreateIntegerValue(42);
original_dict.Set("int", original_int);
@@ -451,12 +451,12 @@ TEST(ValuesTest, DeepCopy) {
}
TEST(ValuesTest, Equals) {
- Value* null1 = Value::CreateNullValue();
- Value* null2 = Value::CreateNullValue();
+ Value* null1 = NullValue();
+ Value* null2 = NullValue();
EXPECT_NE(null1, null2);
EXPECT_TRUE(null1->Equals(null2));
- Value* boolean = Value::CreateBooleanValue(false);
+ Value* boolean = FalseValue();
EXPECT_FALSE(null1->Equals(boolean));
delete null1;
delete null2;
@@ -468,14 +468,14 @@ TEST(ValuesTest, Equals) {
dv.SetDouble("c", 2.5);
dv.SetString("d1", "string");
dv.SetString("d2", ASCIIToUTF16("http://google.com"));
- dv.Set("e", Value::CreateNullValue());
+ dv.Set("e", NullValue());
scoped_ptr<DictionaryValue> copy;
copy.reset(dv.DeepCopy());
EXPECT_TRUE(dv.Equals(copy.get()));
ListValue* list = new ListValue;
- list->Append(Value::CreateNullValue());
+ list->Append(NullValue());
list->Append(new DictionaryValue);
dv.Set("f", list);
@@ -483,7 +483,7 @@ TEST(ValuesTest, Equals) {
copy->Set("f", list->DeepCopy());
EXPECT_TRUE(dv.Equals(copy.get()));
- list->Append(Value::CreateBooleanValue(true));
+ list->Append(TrueValue());
EXPECT_FALSE(dv.Equals(copy.get()));
// Check if Equals detects differences in only the keys.
@@ -495,8 +495,8 @@ TEST(ValuesTest, Equals) {
}
TEST(ValuesTest, StaticEquals) {
- scoped_ptr<Value> null1(Value::CreateNullValue());
- scoped_ptr<Value> null2(Value::CreateNullValue());
+ scoped_ptr<Value> null1(NullValue());
+ scoped_ptr<Value> null2(NullValue());
EXPECT_TRUE(Value::Equals(null1.get(), null2.get()));
EXPECT_TRUE(Value::Equals(NULL, NULL));
@@ -510,7 +510,7 @@ TEST(ValuesTest, StaticEquals) {
EXPECT_FALSE(Value::Equals(i42.get(), NULL));
EXPECT_FALSE(Value::Equals(NULL, i42.get()));
- // NULL and Value::CreateNullValue() are intentionally different: We need
+ // NULL and NullValue() 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));
@@ -519,9 +519,9 @@ TEST(ValuesTest, StaticEquals) {
TEST(ValuesTest, DeepCopyCovariantReturnTypes) {
DictionaryValue original_dict;
- Value* original_null = Value::CreateNullValue();
+ Value* original_null = NullValue();
original_dict.Set("null", original_null);
- FundamentalValue* original_bool = Value::CreateBooleanValue(true);
+ FundamentalValue* original_bool = TrueValue();
original_dict.Set("bool", original_bool);
FundamentalValue* original_int = Value::CreateIntegerValue(42);
original_dict.Set("int", original_int);
« no previous file with comments | « base/values.cc ('k') | chrome/browser/automation/automation_provider_observers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698