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

Unified Diff: base/values_unittest.cc

Issue 12092021: Remove PersistentPrefStore::MarkNeedsEmptyValue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix some tests. Created 7 years, 11 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/prefs/pref_service.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 98bc73c9a1b7ee50613ec562cd233a3eca23cccf..b345415d52d770dcd2cb2400f45912c45f8d951e 100644
--- a/base/values_unittest.cc
+++ b/base/values_unittest.cc
@@ -325,6 +325,31 @@ TEST(ValuesTest, DictionaryWithoutPathExpansion) {
EXPECT_EQ(Value::TYPE_NULL, value4->GetType());
}
+TEST(ValuesTest, DictionaryRemovePath) {
+ DictionaryValue dict;
+ dict.Set("a.long.way.down", Value::CreateIntegerValue(1));
+ dict.Set("a.long.key.path", Value::CreateBooleanValue(true));
+
+ base::Value* out_value = NULL;
+ EXPECT_TRUE(dict.RemovePath("a.long.way.down", &out_value));
+ ASSERT_TRUE(out_value);
+ EXPECT_TRUE(out_value->IsType(base::Value::TYPE_INTEGER));
+ EXPECT_FALSE(dict.HasKey("a.long.way.down"));
+ EXPECT_FALSE(dict.HasKey("a.long.way"));
+ EXPECT_TRUE(dict.Get("a.long.key.path", NULL));
+
+ out_value = NULL;
+ EXPECT_FALSE(dict.RemovePath("a.long.way.down", &out_value));
+ EXPECT_FALSE(out_value);
+ EXPECT_TRUE(dict.Get("a.long.key.path", NULL));
+
+ out_value = NULL;
+ EXPECT_TRUE(dict.RemovePath("a.long.key.path", &out_value));
+ ASSERT_TRUE(out_value);
+ EXPECT_TRUE(out_value->IsType(base::Value::TYPE_BOOLEAN));
+ EXPECT_TRUE(dict.empty());
+}
+
TEST(ValuesTest, DeepCopy) {
DictionaryValue original_dict;
Value* original_null = Value::CreateNullValue();
« no previous file with comments | « base/values.cc ('k') | chrome/browser/prefs/pref_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698