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

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

Issue 14141006: [components] Switch {RefCounted}ProfileKeyedService to use BrowserContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for review Created 7 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 unified diff | Download patch | Annotate | Revision Log
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 <vector> 7 #include <vector>
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 287
288 WebDatabase* web_database_; 288 WebDatabase* web_database_;
289 AutocompleteSyncableService* autocomplete_syncable_service_; 289 AutocompleteSyncableService* autocomplete_syncable_service_;
290 AutofillProfileSyncableService* autofill_profile_syncable_service_; 290 AutofillProfileSyncableService* autofill_profile_syncable_service_;
291 291
292 WaitableEvent syncable_service_created_or_destroyed_; 292 WaitableEvent syncable_service_created_or_destroyed_;
293 293
294 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFake); 294 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFake);
295 }; 295 };
296 296
297 ProfileKeyedService* BuildMockWebDataServiceWrapper(Profile* profile) { 297 ProfileKeyedService* BuildMockWebDataServiceWrapper(
298 content::BrowserContext* profile) {
298 return new MockWebDataServiceWrapper( 299 return new MockWebDataServiceWrapper(
299 new TokenWebDataServiceFake(), 300 new TokenWebDataServiceFake(),
300 new WebDataServiceFake()); 301 new WebDataServiceFake());
301 } 302 }
302 303
303 ACTION_P(MakeAutocompleteSyncComponents, wds) { 304 ACTION_P(MakeAutocompleteSyncComponents, wds) {
304 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB)); 305 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB));
305 if (!BrowserThread::CurrentlyOn(BrowserThread::DB)) 306 if (!BrowserThread::CurrentlyOn(BrowserThread::DB))
306 return base::WeakPtr<syncer::SyncableService>(); 307 return base::WeakPtr<syncer::SyncableService>();
307 return AutocompleteSyncableService::FromWebDataService(wds)->AsWeakPtr(); 308 return AutocompleteSyncableService::FromWebDataService(wds)->AsWeakPtr();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 MockPersonalDataManager() : PersonalDataManager("en-US") {} 400 MockPersonalDataManager() : PersonalDataManager("en-US") {}
400 MOCK_CONST_METHOD0(IsDataLoaded, bool()); 401 MOCK_CONST_METHOD0(IsDataLoaded, bool());
401 MOCK_METHOD0(LoadProfiles, void()); 402 MOCK_METHOD0(LoadProfiles, void());
402 MOCK_METHOD0(LoadCreditCards, void()); 403 MOCK_METHOD0(LoadCreditCards, void());
403 MOCK_METHOD0(Refresh, void()); 404 MOCK_METHOD0(Refresh, void());
404 }; 405 };
405 406
406 class MockPersonalDataManagerService 407 class MockPersonalDataManagerService
407 : public autofill::PersonalDataManagerService { 408 : public autofill::PersonalDataManagerService {
408 public: 409 public:
409 static ProfileKeyedService* Build(Profile* profile) { 410 static ProfileKeyedService* Build(content::BrowserContext* profile) {
410 return new MockPersonalDataManagerService(); 411 return new MockPersonalDataManagerService();
411 } 412 }
412 413
413 MockPersonalDataManagerService() { 414 MockPersonalDataManagerService() {
414 personal_data_manager_.reset(new MockPersonalDataManager()); 415 personal_data_manager_.reset(new MockPersonalDataManager());
415 } 416 }
416 virtual ~MockPersonalDataManagerService() {} 417 virtual ~MockPersonalDataManagerService() {}
417 418
418 virtual void Shutdown() OVERRIDE { 419 virtual void Shutdown() OVERRIDE {
419 personal_data_manager_.reset(); 420 personal_data_manager_.reset();
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 std::vector<AutofillEntry> sync_entries; 1365 std::vector<AutofillEntry> sync_entries;
1365 std::vector<AutofillProfile> sync_profiles; 1366 std::vector<AutofillProfile> sync_profiles;
1366 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); 1367 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles));
1367 EXPECT_EQ(3U, sync_entries.size()); 1368 EXPECT_EQ(3U, sync_entries.size());
1368 EXPECT_EQ(0U, sync_profiles.size()); 1369 EXPECT_EQ(0U, sync_profiles.size());
1369 for (size_t i = 0; i < sync_entries.size(); i++) { 1370 for (size_t i = 0; i < sync_entries.size(); i++) {
1370 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() 1371 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name()
1371 << ", " << sync_entries[i].key().value(); 1372 << ", " << sync_entries[i].key().value();
1372 } 1373 }
1373 } 1374 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698