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

Unified Diff: chrome/browser/sync/profile_sync_service_preference_unittest.cc

Issue 10152003: sync: Make BaseNode lookup-related Init functions return specific failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: init Created 8 years, 8 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
Index: chrome/browser/sync/profile_sync_service_preference_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_service_preference_unittest.cc b/chrome/browser/sync/profile_sync_service_preference_unittest.cc
index da17a86d9bb32187473afad24aafa9437b3c1eb7..ab883309fcb9be2321b93ac65e10739d6eb8efa7 100644
--- a/chrome/browser/sync/profile_sync_service_preference_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_preference_unittest.cc
@@ -63,16 +63,19 @@ class ProfileSyncServicePreferenceTest
int64 SetSyncedValue(const std::string& name, const Value& value) {
sync_api::WriteTransaction trans(FROM_HERE, service_->GetUserShare());
sync_api::ReadNode root(&trans);
- if (!root.InitByTagLookup(
- syncable::ModelTypeToRootTag(syncable::PREFERENCES))) {
+ if (root.InitByTagLookup(
+ syncable::ModelTypeToRootTag(syncable::PREFERENCES)) !=
Nicolas Zea 2012/04/19 23:55:43 nit: move to prev line? (if it fits)
tim (not reviewing) 2012/04/20 18:27:04 Done.
+ sync_api::BaseNode::INIT_OK) {
return sync_api::kInvalidId;
}
sync_api::WriteNode tag_node(&trans);
sync_api::WriteNode node(&trans);
- if (tag_node.InitByClientTagLookup(syncable::PREFERENCES, name))
+ if (tag_node.InitByClientTagLookup(syncable::PREFERENCES, name) ==
+ sync_api::BaseNode::INIT_OK) {
return WriteSyncedValue(name, value, &tag_node);
+ }
if (node.InitUniqueByCreation(syncable::PREFERENCES, root, name))
return WriteSyncedValue(name, value, &node);
@@ -158,8 +161,10 @@ class ProfileSyncServicePreferenceTest
sync_api::ReadTransaction trans(FROM_HERE, service_->GetUserShare());
sync_api::ReadNode node(&trans);
- if (!node.InitByClientTagLookup(syncable::PREFERENCES, name))
+ if (node.InitByClientTagLookup(syncable::PREFERENCES, name) !=
+ sync_api::BaseNode::INIT_OK) {
return NULL;
+ }
const sync_pb::PreferenceSpecifics& specifics(
node.GetEntitySpecifics().preference());

Powered by Google App Engine
This is Rietveld 408576698