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

Side by Side Diff: chrome/browser/sync/profile_sync_service_autofill_unittest.cc

Issue 1460723004: [Sync] Remove the last datatype-specific deps from sync_driver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delete outdated comment. Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 ~TestSyncClient() override {} 156 ~TestSyncClient() override {}
157 157
158 // FakeSyncClient overrides. 158 // FakeSyncClient overrides.
159 autofill::PersonalDataManager* GetPersonalDataManager() override { 159 autofill::PersonalDataManager* GetPersonalDataManager() override {
160 return pdm_; 160 return pdm_;
161 } 161 }
162 sync_driver::SyncService* GetSyncService() override { 162 sync_driver::SyncService* GetSyncService() override {
163 DCHECK(sync_service_); 163 DCHECK(sync_service_);
164 return sync_service_; 164 return sync_service_;
165 } 165 }
166 scoped_refptr<autofill::AutofillWebDataService> GetWebDataService() override {
167 return web_data_service_;
168 }
169 base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( 166 base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType(
170 syncer::ModelType type) override { 167 syncer::ModelType type) override {
171 DCHECK(type == AUTOFILL || type == AUTOFILL_PROFILE); 168 DCHECK(type == AUTOFILL || type == AUTOFILL_PROFILE);
172 if (type == AUTOFILL) { 169 if (type == AUTOFILL) {
173 return AutocompleteSyncableService::FromWebDataService( 170 return AutocompleteSyncableService::FromWebDataService(
174 web_data_service_.get())->AsWeakPtr(); 171 web_data_service_.get())->AsWeakPtr();
175 } else { 172 } else {
176 return AutofillProfileSyncableService::FromWebDataService( 173 return AutofillProfileSyncableService::FromWebDataService(
177 web_data_service_.get())->AsWeakPtr(); 174 web_data_service_.get())->AsWeakPtr();
178 } 175 }
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 int time_shift) { 668 int time_shift) {
672 return MakeAutofillEntry(name, value, time_shift, -1); 669 return MakeAutofillEntry(name, value, time_shift, -1);
673 } 670 }
674 671
675 DataTypeController* CreateDataTypeController(syncer::ModelType type) { 672 DataTypeController* CreateDataTypeController(syncer::ModelType type) {
676 DCHECK(type == AUTOFILL || type == AUTOFILL_PROFILE); 673 DCHECK(type == AUTOFILL || type == AUTOFILL_PROFILE);
677 if (type == AUTOFILL) { 674 if (type == AUTOFILL) {
678 return new AutofillDataTypeController( 675 return new AutofillDataTypeController(
679 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 676 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
680 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), 677 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
681 base::Bind(&base::DoNothing), sync_client_.get()); 678 base::Bind(&base::DoNothing), sync_client_.get(), web_data_service_);
682 } else { 679 } else {
683 return new AutofillProfileDataTypeController( 680 return new AutofillProfileDataTypeController(
684 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 681 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
685 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), 682 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
686 base::Bind(&base::DoNothing), sync_client_.get()); 683 base::Bind(&base::DoNothing), sync_client_.get(), web_data_service_);
687 } 684 }
688 } 685 }
689 686
690 friend class AddAutofillHelper<AutofillEntry>; 687 friend class AddAutofillHelper<AutofillEntry>;
691 friend class AddAutofillHelper<AutofillProfile>; 688 friend class AddAutofillHelper<AutofillProfile>;
692 friend class FakeServerUpdater; 689 friend class FakeServerUpdater;
693 690
694 TestingProfileManager profile_manager_; 691 TestingProfileManager profile_manager_;
695 TestingProfile* profile_; 692 TestingProfile* profile_;
696 AutofillTableMock autofill_table_; 693 AutofillTableMock autofill_table_;
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 std::vector<AutofillEntry> sync_entries; 1307 std::vector<AutofillEntry> sync_entries;
1311 std::vector<AutofillProfile> sync_profiles; 1308 std::vector<AutofillProfile> sync_profiles;
1312 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); 1309 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles));
1313 EXPECT_EQ(3U, sync_entries.size()); 1310 EXPECT_EQ(3U, sync_entries.size());
1314 EXPECT_EQ(0U, sync_profiles.size()); 1311 EXPECT_EQ(0U, sync_profiles.size());
1315 for (size_t i = 0; i < sync_entries.size(); i++) { 1312 for (size_t i = 0; i < sync_entries.size(); i++) {
1316 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() 1313 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name()
1317 << ", " << sync_entries[i].key().value(); 1314 << ", " << sync_entries[i].key().value();
1318 } 1315 }
1319 } 1316 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/chrome_sync_client.cc ('k') | components/autofill/core/browser/autofill_wallet_data_type_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698