OLD | NEW |
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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 WebDatabase* web_database_; | 330 WebDatabase* web_database_; |
331 AutocompleteSyncableService* autocomplete_syncable_service_; | 331 AutocompleteSyncableService* autocomplete_syncable_service_; |
332 AutofillProfileSyncableService* autofill_profile_syncable_service_; | 332 AutofillProfileSyncableService* autofill_profile_syncable_service_; |
333 scoped_ptr<autofill::AutofillWebDataBackend> backend_; | 333 scoped_ptr<autofill::AutofillWebDataBackend> backend_; |
334 | 334 |
335 WaitableEvent syncable_service_created_or_destroyed_; | 335 WaitableEvent syncable_service_created_or_destroyed_; |
336 | 336 |
337 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFake); | 337 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFake); |
338 }; | 338 }; |
339 | 339 |
340 KeyedService* BuildMockWebDataServiceWrapper(content::BrowserContext* profile) { | 340 scoped_ptr<KeyedService> BuildMockWebDataServiceWrapper( |
341 return new MockWebDataServiceWrapper( | 341 content::BrowserContext* profile) { |
342 new WebDataServiceFake(), | 342 return make_scoped_ptr(new MockWebDataServiceWrapper( |
343 new TokenWebDataServiceFake()); | 343 new WebDataServiceFake(), new TokenWebDataServiceFake())); |
344 } | 344 } |
345 | 345 |
346 ACTION_P(MakeAutocompleteSyncComponents, wds) { | 346 ACTION_P(MakeAutocompleteSyncComponents, wds) { |
347 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 347 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
348 if (!BrowserThread::CurrentlyOn(BrowserThread::DB)) | 348 if (!BrowserThread::CurrentlyOn(BrowserThread::DB)) |
349 return base::WeakPtr<syncer::SyncableService>(); | 349 return base::WeakPtr<syncer::SyncableService>(); |
350 return AutocompleteSyncableService::FromWebDataService(wds)->AsWeakPtr(); | 350 return AutocompleteSyncableService::FromWebDataService(wds)->AsWeakPtr(); |
351 } | 351 } |
352 | 352 |
353 ACTION_P(ReturnNewDataTypeManagerWithDebugListener, debug_listener) { | 353 ACTION_P(ReturnNewDataTypeManagerWithDebugListener, debug_listener) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 }; | 418 }; |
419 | 419 |
420 class MockPersonalDataManager : public PersonalDataManager { | 420 class MockPersonalDataManager : public PersonalDataManager { |
421 public: | 421 public: |
422 MockPersonalDataManager() : PersonalDataManager("en-US") {} | 422 MockPersonalDataManager() : PersonalDataManager("en-US") {} |
423 MOCK_CONST_METHOD0(IsDataLoaded, bool()); | 423 MOCK_CONST_METHOD0(IsDataLoaded, bool()); |
424 MOCK_METHOD0(LoadProfiles, void()); | 424 MOCK_METHOD0(LoadProfiles, void()); |
425 MOCK_METHOD0(LoadCreditCards, void()); | 425 MOCK_METHOD0(LoadCreditCards, void()); |
426 MOCK_METHOD0(Refresh, void()); | 426 MOCK_METHOD0(Refresh, void()); |
427 | 427 |
428 static KeyedService* Build(content::BrowserContext* profile) { | 428 static scoped_ptr<KeyedService> Build(content::BrowserContext* profile) { |
429 return new MockPersonalDataManager(); | 429 return make_scoped_ptr(new MockPersonalDataManager()); |
430 } | 430 } |
431 }; | 431 }; |
432 | 432 |
433 template <class T> class AddAutofillHelper; | 433 template <class T> class AddAutofillHelper; |
434 | 434 |
435 class ProfileSyncServiceAutofillTest | 435 class ProfileSyncServiceAutofillTest |
436 : public AbstractProfileSyncServiceTest, | 436 : public AbstractProfileSyncServiceTest, |
437 public syncer::DataTypeDebugInfoListener { | 437 public syncer::DataTypeDebugInfoListener { |
438 public: | 438 public: |
439 // DataTypeDebugInfoListener implementation. | 439 // DataTypeDebugInfoListener implementation. |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 std::vector<AutofillEntry> sync_entries; | 1343 std::vector<AutofillEntry> sync_entries; |
1344 std::vector<AutofillProfile> sync_profiles; | 1344 std::vector<AutofillProfile> sync_profiles; |
1345 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); | 1345 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); |
1346 EXPECT_EQ(3U, sync_entries.size()); | 1346 EXPECT_EQ(3U, sync_entries.size()); |
1347 EXPECT_EQ(0U, sync_profiles.size()); | 1347 EXPECT_EQ(0U, sync_profiles.size()); |
1348 for (size_t i = 0; i < sync_entries.size(); i++) { | 1348 for (size_t i = 0; i < sync_entries.size(); i++) { |
1349 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() | 1349 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() |
1350 << ", " << sync_entries[i].key().value(); | 1350 << ", " << sync_entries[i].key().value(); |
1351 } | 1351 } |
1352 } | 1352 } |
OLD | NEW |