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

Unified Diff: chrome/browser/sync/profile_sync_service_autofill_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_autofill_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
index f6802149bd9cf76e608c76f31d11c51c98d356b8..b3301fe47f219ec63053b6afbb8398fe6f7538a2 100644
--- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
@@ -82,6 +82,7 @@ using syncable::SPECIFICS;
using syncable::UNITTEST;
using syncable::WriterTag;
using syncable::WriteTransaction;
+using sync_api::BaseNode;
Nicolas Zea 2012/04/19 23:55:43 nit: remove this or remove BaseNode:: prefix's bel
tim (not reviewing) 2012/04/20 18:27:04 As discussed offline, using decl only lets us drop
using testing::_;
using testing::DoAll;
using testing::DoDefault;
@@ -436,9 +437,11 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
bool AddAutofillSyncNode(const AutofillEntry& entry) {
sync_api::WriteTransaction trans(FROM_HERE, service_->GetUserShare());
sync_api::ReadNode autofill_root(&trans);
- if (!autofill_root.InitByTagLookup(
- syncable::ModelTypeToRootTag(syncable::AUTOFILL)))
+ if (autofill_root.InitByTagLookup(
+ syncable::ModelTypeToRootTag(syncable::AUTOFILL)) !=
+ BaseNode::INIT_OK) {
return false;
+ }
sync_api::WriteNode node(&trans);
std::string tag = AutocompleteSyncableService::KeyToTag(
@@ -457,8 +460,10 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
bool AddAutofillSyncNode(const AutofillProfile& profile) {
sync_api::WriteTransaction trans(FROM_HERE, service_->GetUserShare());
sync_api::ReadNode autofill_root(&trans);
- if (!autofill_root.InitByTagLookup(kAutofillProfileTag))
+ if (autofill_root.InitByTagLookup(kAutofillProfileTag) !=
+ BaseNode::INIT_OK) {
return false;
+ }
sync_api::WriteNode node(&trans);
std::string tag = profile.guid();
if (!node.InitUniqueByCreation(syncable::AUTOFILL_PROFILE,
@@ -476,14 +481,16 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
std::vector<AutofillProfile>* profiles) {
sync_api::ReadTransaction trans(FROM_HERE, service_->GetUserShare());
sync_api::ReadNode autofill_root(&trans);
- if (!autofill_root.InitByTagLookup(
- syncable::ModelTypeToRootTag(syncable::AUTOFILL)))
+ if (autofill_root.InitByTagLookup(
+ syncable::ModelTypeToRootTag(syncable::AUTOFILL)) !=
+ BaseNode::INIT_OK) {
return false;
+ }
int64 child_id = autofill_root.GetFirstChildId();
while (child_id != sync_api::kInvalidId) {
sync_api::ReadNode child_node(&trans);
- if (!child_node.InitByIdLookup(child_id))
+ if (child_node.InitByIdLookup(child_id) != BaseNode::INIT_OK)
return false;
const sync_pb::AutofillSpecifics& autofill(
@@ -514,13 +521,15 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
std::vector<AutofillProfile>* profiles) {
sync_api::ReadTransaction trans(FROM_HERE, service_->GetUserShare());
sync_api::ReadNode autofill_root(&trans);
- if (!autofill_root.InitByTagLookup(kAutofillProfileTag))
+ if (autofill_root.InitByTagLookup(kAutofillProfileTag) !=
+ BaseNode::INIT_OK) {
return false;
+ }
int64 child_id = autofill_root.GetFirstChildId();
while (child_id != sync_api::kInvalidId) {
sync_api::ReadNode child_node(&trans);
- if (!child_node.InitByIdLookup(child_id))
+ if (child_node.InitByIdLookup(child_id) != BaseNode::INIT_OK)
return false;
const sync_pb::AutofillProfileSpecifics& autofill(

Powered by Google App Engine
This is Rietveld 408576698