OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return sync_api::kInvalidId; | 68 return sync_api::kInvalidId; |
69 } | 69 } |
70 | 70 |
71 sync_api::WriteNode tag_node(&trans); | 71 sync_api::WriteNode tag_node(&trans); |
72 sync_api::WriteNode node(&trans); | 72 sync_api::WriteNode node(&trans); |
73 | 73 |
74 if (tag_node.InitByClientTagLookup(syncable::PREFERENCES, name) == | 74 if (tag_node.InitByClientTagLookup(syncable::PREFERENCES, name) == |
75 sync_api::BaseNode::INIT_OK) { | 75 sync_api::BaseNode::INIT_OK) { |
76 return WriteSyncedValue(name, value, &tag_node); | 76 return WriteSyncedValue(name, value, &tag_node); |
77 } | 77 } |
78 if (node.InitUniqueByCreation(syncable::PREFERENCES, root, name)) | 78 |
| 79 sync_api::WriteNode::InitUniqueByCreationResult result = |
| 80 node.InitUniqueByCreation(syncable::PREFERENCES, root, name); |
| 81 if (result == sync_api::WriteNode::INIT_SUCCESS) |
79 return WriteSyncedValue(name, value, &node); | 82 return WriteSyncedValue(name, value, &node); |
80 | 83 |
81 return sync_api::kInvalidId; | 84 return sync_api::kInvalidId; |
82 } | 85 } |
83 | 86 |
84 protected: | 87 protected: |
85 ProfileSyncServicePreferenceTest() | 88 ProfileSyncServicePreferenceTest() |
86 : example_url0_("http://example.com/0"), | 89 : example_url0_("http://example.com/0"), |
87 example_url1_("http://example.com/1"), | 90 example_url1_("http://example.com/1"), |
88 example_url2_("http://example.com/2"), | 91 example_url2_("http://example.com/2"), |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 EXPECT_FALSE(pref->IsDefaultValue()); | 575 EXPECT_FALSE(pref->IsDefaultValue()); |
573 // There should be no synced value. | 576 // There should be no synced value. |
574 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); | 577 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); |
575 // Switch kHomePage back to unmanaged. | 578 // Switch kHomePage back to unmanaged. |
576 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); | 579 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); |
577 // The original value should be picked up. | 580 // The original value should be picked up. |
578 EXPECT_TRUE(pref->IsDefaultValue()); | 581 EXPECT_TRUE(pref->IsDefaultValue()); |
579 // There should still be no synced value. | 582 // There should still be no synced value. |
580 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); | 583 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); |
581 } | 584 } |
OLD | NEW |