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

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

Issue 10804039: Make SyncBackendRegistrar aware of loaded data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better comments Created 8 years, 5 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 53e6b3ee9d65bbaf1f57b9cf6a2e2ec7290a13a5..de4a3063ec471b0401b206199f25ac9627eb75a2 100644
--- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
@@ -398,9 +398,10 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
AbstractProfileSyncServiceTest::TearDown();
}
- void StartSyncService(const base::Closure& callback,
- bool will_fail_association,
- syncer::ModelType type) {
+ void StartSyncService(
+ const base::Callback<void(syncer::UserShare*)>& callback,
+ bool will_fail_association,
+ syncer::ModelType type) {
AbstractAutofillFactory* factory = GetFactory(type);
SigninManager* signin = SigninManagerFactory::GetForProfile(profile_.get());
signin->SetAuthenticatedUsername("test_user");
@@ -437,8 +438,10 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
MessageLoop::current()->Run();
}
- bool AddAutofillSyncNode(const AutofillEntry& entry) {
- syncer::WriteTransaction trans(FROM_HERE, service_->GetUserShare());
+ bool AddAutofillSyncNode(
+ const AutofillEntry& entry,
+ syncer::UserShare* user_share) {
+ syncer::WriteTransaction trans(FROM_HERE, user_share);
syncer::ReadNode autofill_root(&trans);
if (autofill_root.InitByTagLookup(
syncer::ModelTypeToRootTag(syncer::AUTOFILL)) !=
@@ -462,8 +465,9 @@ class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
return true;
}
- bool AddAutofillSyncNode(const AutofillProfile& profile) {
- syncer::WriteTransaction trans(FROM_HERE, service_->GetUserShare());
+ bool AddAutofillSyncNode(const AutofillProfile& profile,
+ syncer::UserShare* user_share) {
+ syncer::WriteTransaction trans(FROM_HERE, user_share);
syncer::ReadNode autofill_root(&trans);
if (autofill_root.InitByTagLookup(kAutofillProfileTag) !=
BaseNode::INIT_OK) {
@@ -603,23 +607,29 @@ class AddAutofillHelper {
success_(false) {
}
- const base::Closure& callback() const { return callback_; }
- bool success() { return success_; }
+ const base::Callback<void(syncer::UserShare* user_share)>& callback() const {
+ return callback_;
+ }
+
+ bool success() {
+ return success_;
+ }
private:
void AddAutofillCallback(ProfileSyncServiceAutofillTest* test,
- const std::vector<T>& entries) {
- if (!test->CreateRoot(GetModelType<T>()))
+ const std::vector<T>& entries,
+ syncer::UserShare* user_share) {
+ if (!test->CreateRoot(GetModelType<T>(), user_share))
return;
for (size_t i = 0; i < entries.size(); ++i) {
- if (!test->AddAutofillSyncNode(entries[i]))
+ if (!test->AddAutofillSyncNode(entries[i], user_share))
return;
}
success_ = true;
}
- base::Closure callback_;
+ base::Callback<void(syncer::UserShare* user_share)> callback_;
bool success_;
};
@@ -772,7 +782,8 @@ bool IncludesField(const AutofillProfile& profile1,
// waiting for the PersonalDataManager.
TEST_F(ProfileSyncServiceAutofillTest, FailModelAssociation) {
// Don't create the root autofill node so startup fails.
- StartSyncService(base::Closure(), true, syncer::AUTOFILL);
+ StartSyncService(TestProfileSyncService::NullCallback(), true,
+ syncer::AUTOFILL);
EXPECT_TRUE(service_->HasUnrecoverableError());
}
@@ -1234,7 +1245,7 @@ TEST_F(ProfileSyncServiceAutofillTest, DISABLED_ServerChangeRace) {
wait_for_start->Wait();
AutofillEntry syncapi_entry(MakeAutofillEntry("syncapi", "entry", 2));
- ASSERT_TRUE(AddAutofillSyncNode(syncapi_entry));
+ ASSERT_TRUE(AddAutofillSyncNode(syncapi_entry, service_->GetUserShare()));
DVLOG(1) << "Syncapi update finished.";
// If we reach here, it means syncapi succeeded and we didn't deadlock. Yay!

Powered by Google App Engine
This is Rietveld 408576698