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

Unified Diff: chrome/browser/prefs/pref_value_map_unittest.cc

Issue 9016010: Implement pref_value_map swap function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | « chrome/browser/prefs/pref_value_map.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_value_map_unittest.cc
diff --git a/chrome/browser/prefs/pref_value_map_unittest.cc b/chrome/browser/prefs/pref_value_map_unittest.cc
index 08aa57851550ec8bd59e2729cef0a70a7f62aa7c..6fbddea1958301f56c8430720af05ac1cb149e09 100644
--- a/chrome/browser/prefs/pref_value_map_unittest.cc
+++ b/chrome/browser/prefs/pref_value_map_unittest.cc
@@ -87,3 +87,25 @@ TEST_F(PrefValueMapTest, GetDifferingKeys) {
expected_differing_paths.push_back("e");
EXPECT_EQ(expected_differing_paths, differing_paths);
}
+
+TEST_F(PrefValueMapTest, SwapTwoMaps) {
+ PrefValueMap first_map;
+ EXPECT_TRUE(first_map.SetValue("a", Value::CreateStringValue("test")));
+ EXPECT_TRUE(first_map.SetValue("b", Value::CreateStringValue("test")));
+ EXPECT_TRUE(first_map.SetValue("c", Value::CreateStringValue("test")));
+
+ PrefValueMap second_map;
+ EXPECT_TRUE(second_map.SetValue("d", Value::CreateStringValue("test")));
+ EXPECT_TRUE(second_map.SetValue("e", Value::CreateStringValue("test")));
+ EXPECT_TRUE(second_map.SetValue("f", Value::CreateStringValue("test")));
+
+ first_map.Swap(&second_map);
+
+ EXPECT_TRUE(first_map.GetValue("d", NULL));
+ EXPECT_TRUE(first_map.GetValue("e", NULL));
+ EXPECT_TRUE(first_map.GetValue("f", NULL));
+
+ EXPECT_TRUE(second_map.GetValue("a", NULL));
+ EXPECT_TRUE(second_map.GetValue("b", NULL));
+ EXPECT_TRUE(second_map.GetValue("c", NULL));
+}
« no previous file with comments | « chrome/browser/prefs/pref_value_map.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698