| Index: base/prefs/pref_value_map_unittest.cc
|
| diff --git a/base/prefs/pref_value_map_unittest.cc b/base/prefs/pref_value_map_unittest.cc
|
| index 82499daf9c37bbbe563163ac87b9b3ae4a7545c9..f78c999916316ee1c4179cd9dd4db37f3cb513b8 100644
|
| --- a/base/prefs/pref_value_map_unittest.cc
|
| +++ b/base/prefs/pref_value_map_unittest.cc
|
| @@ -16,9 +16,9 @@ TEST(PrefValueMapTest, SetValue) {
|
| EXPECT_FALSE(map.GetValue("key", &result));
|
| EXPECT_FALSE(result);
|
|
|
| - EXPECT_TRUE(map.SetValue("key", new StringValue("test")));
|
| - EXPECT_FALSE(map.SetValue("key", new StringValue("test")));
|
| - EXPECT_TRUE(map.SetValue("key", new StringValue("hi mom!")));
|
| + EXPECT_TRUE(map.SetValue("key", make_scoped_ptr(new StringValue("test"))));
|
| + EXPECT_FALSE(map.SetValue("key", make_scoped_ptr(new StringValue("test"))));
|
| + EXPECT_TRUE(map.SetValue("key", make_scoped_ptr(new StringValue("hi mom!"))));
|
|
|
| EXPECT_TRUE(map.GetValue("key", &result));
|
| EXPECT_TRUE(StringValue("hi mom!").Equals(result));
|
| @@ -26,7 +26,7 @@ TEST(PrefValueMapTest, SetValue) {
|
|
|
| TEST(PrefValueMapTest, GetAndSetIntegerValue) {
|
| PrefValueMap map;
|
| - ASSERT_TRUE(map.SetValue("key", new FundamentalValue(5)));
|
| + ASSERT_TRUE(map.SetValue("key", make_scoped_ptr(new FundamentalValue(5))));
|
|
|
| int int_value = 0;
|
| EXPECT_TRUE(map.GetInteger("key", &int_value));
|
| @@ -39,7 +39,7 @@ TEST(PrefValueMapTest, GetAndSetIntegerValue) {
|
|
|
| TEST(PrefValueMapTest, SetDoubleValue) {
|
| PrefValueMap map;
|
| - ASSERT_TRUE(map.SetValue("key", new FundamentalValue(5.5)));
|
| + ASSERT_TRUE(map.SetValue("key", make_scoped_ptr(new FundamentalValue(5.5))));
|
|
|
| const Value* result = NULL;
|
| ASSERT_TRUE(map.GetValue("key", &result));
|
| @@ -52,7 +52,7 @@ TEST(PrefValueMapTest, RemoveValue) {
|
| PrefValueMap map;
|
| EXPECT_FALSE(map.RemoveValue("key"));
|
|
|
| - EXPECT_TRUE(map.SetValue("key", new StringValue("test")));
|
| + EXPECT_TRUE(map.SetValue("key", make_scoped_ptr(new StringValue("test"))));
|
| EXPECT_TRUE(map.GetValue("key", NULL));
|
|
|
| EXPECT_TRUE(map.RemoveValue("key"));
|
| @@ -63,7 +63,7 @@ TEST(PrefValueMapTest, RemoveValue) {
|
|
|
| TEST(PrefValueMapTest, Clear) {
|
| PrefValueMap map;
|
| - EXPECT_TRUE(map.SetValue("key", new StringValue("test")));
|
| + EXPECT_TRUE(map.SetValue("key", make_scoped_ptr(new StringValue("test"))));
|
| EXPECT_TRUE(map.GetValue("key", NULL));
|
|
|
| map.Clear();
|
| @@ -73,9 +73,12 @@ TEST(PrefValueMapTest, Clear) {
|
|
|
| TEST(PrefValueMapTest, GetDifferingKeys) {
|
| PrefValueMap reference;
|
| - EXPECT_TRUE(reference.SetValue("b", new StringValue("test")));
|
| - EXPECT_TRUE(reference.SetValue("c", new StringValue("test")));
|
| - EXPECT_TRUE(reference.SetValue("e", new StringValue("test")));
|
| + EXPECT_TRUE(
|
| + reference.SetValue("b", make_scoped_ptr(new StringValue("test"))));
|
| + EXPECT_TRUE(
|
| + reference.SetValue("c", make_scoped_ptr(new StringValue("test"))));
|
| + EXPECT_TRUE(
|
| + reference.SetValue("e", make_scoped_ptr(new StringValue("test"))));
|
|
|
| PrefValueMap check;
|
| std::vector<std::string> differing_paths;
|
| @@ -87,9 +90,9 @@ TEST(PrefValueMapTest, GetDifferingKeys) {
|
| expected_differing_paths.push_back("e");
|
| EXPECT_EQ(expected_differing_paths, differing_paths);
|
|
|
| - EXPECT_TRUE(check.SetValue("a", new StringValue("test")));
|
| - EXPECT_TRUE(check.SetValue("c", new StringValue("test")));
|
| - EXPECT_TRUE(check.SetValue("d", new StringValue("test")));
|
| + EXPECT_TRUE(check.SetValue("a", make_scoped_ptr(new StringValue("test"))));
|
| + EXPECT_TRUE(check.SetValue("c", make_scoped_ptr(new StringValue("test"))));
|
| + EXPECT_TRUE(check.SetValue("d", make_scoped_ptr(new StringValue("test"))));
|
|
|
| reference.GetDifferingKeys(&check, &differing_paths);
|
| expected_differing_paths.clear();
|
| @@ -102,14 +105,20 @@ TEST(PrefValueMapTest, GetDifferingKeys) {
|
|
|
| TEST(PrefValueMapTest, SwapTwoMaps) {
|
| PrefValueMap first_map;
|
| - EXPECT_TRUE(first_map.SetValue("a", new StringValue("test")));
|
| - EXPECT_TRUE(first_map.SetValue("b", new StringValue("test")));
|
| - EXPECT_TRUE(first_map.SetValue("c", new StringValue("test")));
|
| + EXPECT_TRUE(
|
| + first_map.SetValue("a", make_scoped_ptr(new StringValue("test"))));
|
| + EXPECT_TRUE(
|
| + first_map.SetValue("b", make_scoped_ptr(new StringValue("test"))));
|
| + EXPECT_TRUE(
|
| + first_map.SetValue("c", make_scoped_ptr(new StringValue("test"))));
|
|
|
| PrefValueMap second_map;
|
| - EXPECT_TRUE(second_map.SetValue("d", new StringValue("test")));
|
| - EXPECT_TRUE(second_map.SetValue("e", new StringValue("test")));
|
| - EXPECT_TRUE(second_map.SetValue("f", new StringValue("test")));
|
| + EXPECT_TRUE(
|
| + second_map.SetValue("d", make_scoped_ptr(new StringValue("test"))));
|
| + EXPECT_TRUE(
|
| + second_map.SetValue("e", make_scoped_ptr(new StringValue("test"))));
|
| + EXPECT_TRUE(
|
| + second_map.SetValue("f", make_scoped_ptr(new StringValue("test"))));
|
|
|
| first_map.Swap(&second_map);
|
|
|
|
|