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

Unified Diff: base/values_unittest.cc

Issue 441008: Many changes to DictionaryValues:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
===================================================================
--- base/values_unittest.cc (revision 32858)
+++ base/values_unittest.cc (working copy)
@@ -20,9 +20,9 @@
ASSERT_EQ(std::wstring(L"http://google.com"), homepage);
ASSERT_FALSE(settings.Get(L"global", NULL));
- ASSERT_TRUE(settings.Set(L"global", Value::CreateBooleanValue(true)));
+ settings.Set(L"global", Value::CreateBooleanValue(true));
ASSERT_TRUE(settings.Get(L"global", NULL));
- ASSERT_TRUE(settings.SetString(L"global.homepage", L"http://scurvy.com"));
+ settings.SetString(L"global.homepage", L"http://scurvy.com");
ASSERT_TRUE(settings.Get(L"global", NULL));
homepage = L"http://google.com";
ASSERT_TRUE(settings.GetString(L"global.homepage", &homepage));
@@ -285,6 +285,28 @@
}
}
+TEST(ValuesTest, DictionaryWithoutPathExpansion) {
+ DictionaryValue dict;
+ dict.Set(L"this.is.expanded", Value::CreateNullValue());
+ dict.SetWithoutPathExpansion(L"this.isnt.expanded", Value::CreateNullValue());
+
+ EXPECT_FALSE(dict.HasKey(L"this.is.expanded"));
+ EXPECT_TRUE(dict.HasKey(L"this"));
+ Value* value1;
+ EXPECT_TRUE(dict.Get(L"this", &value1));
+ DictionaryValue* value2;
+ ASSERT_TRUE(dict.GetDictionaryWithoutPathExpansion(L"this", &value2));
+ EXPECT_EQ(value1, value2);
+ EXPECT_EQ(1U, value2->size());
+
+ EXPECT_TRUE(dict.HasKey(L"this.isnt.expanded"));
+ Value* value3;
+ EXPECT_FALSE(dict.Get(L"this.isnt.expanded", &value3));
+ Value* value4;
+ ASSERT_TRUE(dict.GetWithoutPathExpansion(L"this.isnt.expanded", &value4));
+ EXPECT_EQ(Value::TYPE_NULL, value4->GetType());
+}
+
TEST(ValuesTest, DeepCopy) {
DictionaryValue original_dict;
Value* original_null = Value::CreateNullValue();
« base/values.cc ('K') | « base/values.cc ('k') | chrome/browser/blocked_popup_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698