| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 using autofill::AutofillProfileChange; | 74 using autofill::AutofillProfileChange; |
| 75 using autofill::AutofillProfileSyncableService; | 75 using autofill::AutofillProfileSyncableService; |
| 76 using autofill::AutofillTable; | 76 using autofill::AutofillTable; |
| 77 using autofill::AutofillWebDataService; | 77 using autofill::AutofillWebDataService; |
| 78 using autofill::PersonalDataManager; | 78 using autofill::PersonalDataManager; |
| 79 using base::Time; | 79 using base::Time; |
| 80 using base::TimeDelta; | 80 using base::TimeDelta; |
| 81 using base::WaitableEvent; | 81 using base::WaitableEvent; |
| 82 using browser_sync::AutofillDataTypeController; | 82 using browser_sync::AutofillDataTypeController; |
| 83 using browser_sync::AutofillProfileDataTypeController; | 83 using browser_sync::AutofillProfileDataTypeController; |
| 84 using browser_sync::DataTypeController; | |
| 85 using content::BrowserThread; | 84 using content::BrowserThread; |
| 86 using syncer::AUTOFILL; | 85 using syncer::AUTOFILL; |
| 87 using syncer::AUTOFILL_PROFILE; | 86 using syncer::AUTOFILL_PROFILE; |
| 88 using syncer::BaseNode; | 87 using syncer::BaseNode; |
| 89 using syncer::syncable::BASE_VERSION; | 88 using syncer::syncable::BASE_VERSION; |
| 90 using syncer::syncable::CREATE; | 89 using syncer::syncable::CREATE; |
| 91 using syncer::syncable::GET_TYPE_ROOT; | 90 using syncer::syncable::GET_TYPE_ROOT; |
| 92 using syncer::syncable::MutableEntry; | 91 using syncer::syncable::MutableEntry; |
| 93 using syncer::syncable::SERVER_SPECIFICS; | 92 using syncer::syncable::SERVER_SPECIFICS; |
| 94 using syncer::syncable::SPECIFICS; | 93 using syncer::syncable::SPECIFICS; |
| 95 using syncer::syncable::UNITTEST; | 94 using syncer::syncable::UNITTEST; |
| 96 using syncer::syncable::WriterTag; | 95 using syncer::syncable::WriterTag; |
| 97 using syncer::syncable::WriteTransaction; | 96 using syncer::syncable::WriteTransaction; |
| 97 using sync_driver::DataTypeController; |
| 98 using testing::_; | 98 using testing::_; |
| 99 using testing::DoAll; | 99 using testing::DoAll; |
| 100 using testing::ElementsAre; | 100 using testing::ElementsAre; |
| 101 using testing::Not; | 101 using testing::Not; |
| 102 using testing::SetArgumentPointee; | 102 using testing::SetArgumentPointee; |
| 103 using testing::Return; | 103 using testing::Return; |
| 104 | 104 |
| 105 class HistoryService; | 105 class HistoryService; |
| 106 | 106 |
| 107 namespace syncable { | 107 namespace syncable { |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 } | 349 } |
| 350 | 350 |
| 351 ACTION_P(MakeAutocompleteSyncComponents, wds) { | 351 ACTION_P(MakeAutocompleteSyncComponents, wds) { |
| 352 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 352 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 353 if (!BrowserThread::CurrentlyOn(BrowserThread::DB)) | 353 if (!BrowserThread::CurrentlyOn(BrowserThread::DB)) |
| 354 return base::WeakPtr<syncer::SyncableService>(); | 354 return base::WeakPtr<syncer::SyncableService>(); |
| 355 return AutocompleteSyncableService::FromWebDataService(wds)->AsWeakPtr(); | 355 return AutocompleteSyncableService::FromWebDataService(wds)->AsWeakPtr(); |
| 356 } | 356 } |
| 357 | 357 |
| 358 ACTION_P(ReturnNewDataTypeManagerWithDebugListener, debug_listener) { | 358 ACTION_P(ReturnNewDataTypeManagerWithDebugListener, debug_listener) { |
| 359 return new browser_sync::DataTypeManagerImpl( | 359 return new sync_driver::DataTypeManagerImpl( |
| 360 base::Closure(), | 360 base::Closure(), |
| 361 debug_listener, | 361 debug_listener, |
| 362 arg1, | 362 arg1, |
| 363 arg2, | 363 arg2, |
| 364 arg3, | 364 arg3, |
| 365 arg4, | 365 arg4, |
| 366 arg5); | 366 arg5); |
| 367 } | 367 } |
| 368 | 368 |
| 369 ACTION_P(MakeAutofillProfileSyncComponents, wds) { | 369 ACTION_P(MakeAutofillProfileSyncComponents, wds) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 381 ProfileSyncService* service) = 0; | 381 ProfileSyncService* service) = 0; |
| 382 virtual void SetExpectation(ProfileSyncComponentsFactoryMock* factory, | 382 virtual void SetExpectation(ProfileSyncComponentsFactoryMock* factory, |
| 383 ProfileSyncService* service, | 383 ProfileSyncService* service, |
| 384 AutofillWebDataService* wds, | 384 AutofillWebDataService* wds, |
| 385 DataTypeController* dtc) = 0; | 385 DataTypeController* dtc) = 0; |
| 386 virtual ~AbstractAutofillFactory() {} | 386 virtual ~AbstractAutofillFactory() {} |
| 387 }; | 387 }; |
| 388 | 388 |
| 389 class AutofillEntryFactory : public AbstractAutofillFactory { | 389 class AutofillEntryFactory : public AbstractAutofillFactory { |
| 390 public: | 390 public: |
| 391 virtual browser_sync::DataTypeController* CreateDataTypeController( | 391 virtual DataTypeController* CreateDataTypeController( |
| 392 ProfileSyncComponentsFactory* factory, | 392 ProfileSyncComponentsFactory* factory, |
| 393 TestingProfile* profile, | 393 TestingProfile* profile, |
| 394 ProfileSyncService* service) OVERRIDE { | 394 ProfileSyncService* service) OVERRIDE { |
| 395 return new AutofillDataTypeController( | 395 return new AutofillDataTypeController( |
| 396 factory, profile, DataTypeController::DisableTypeCallback()); | 396 factory, |
| 397 profile, |
| 398 DataTypeController::DisableTypeCallback()); |
| 397 } | 399 } |
| 398 | 400 |
| 399 virtual void SetExpectation(ProfileSyncComponentsFactoryMock* factory, | 401 virtual void SetExpectation(ProfileSyncComponentsFactoryMock* factory, |
| 400 ProfileSyncService* service, | 402 ProfileSyncService* service, |
| 401 AutofillWebDataService* wds, | 403 AutofillWebDataService* wds, |
| 402 DataTypeController* dtc) OVERRIDE { | 404 DataTypeController* dtc) OVERRIDE { |
| 403 EXPECT_CALL(*factory, GetSyncableServiceForType(syncer::AUTOFILL)). | 405 EXPECT_CALL(*factory, GetSyncableServiceForType(syncer::AUTOFILL)). |
| 404 WillOnce(MakeAutocompleteSyncComponents(wds)); | 406 WillOnce(MakeAutocompleteSyncComponents(wds)); |
| 405 } | 407 } |
| 406 }; | 408 }; |
| 407 | 409 |
| 408 class AutofillProfileFactory : public AbstractAutofillFactory { | 410 class AutofillProfileFactory : public AbstractAutofillFactory { |
| 409 public: | 411 public: |
| 410 virtual browser_sync::DataTypeController* CreateDataTypeController( | 412 virtual DataTypeController* CreateDataTypeController( |
| 411 ProfileSyncComponentsFactory* factory, | 413 ProfileSyncComponentsFactory* factory, |
| 412 TestingProfile* profile, | 414 TestingProfile* profile, |
| 413 ProfileSyncService* service) OVERRIDE { | 415 ProfileSyncService* service) OVERRIDE { |
| 414 return new AutofillProfileDataTypeController( | 416 return new AutofillProfileDataTypeController( |
| 415 factory, profile, DataTypeController::DisableTypeCallback()); | 417 factory, |
| 418 profile, |
| 419 DataTypeController::DisableTypeCallback()); |
| 416 } | 420 } |
| 417 | 421 |
| 418 virtual void SetExpectation(ProfileSyncComponentsFactoryMock* factory, | 422 virtual void SetExpectation(ProfileSyncComponentsFactoryMock* factory, |
| 419 ProfileSyncService* service, | 423 ProfileSyncService* service, |
| 420 AutofillWebDataService* wds, | 424 AutofillWebDataService* wds, |
| 421 DataTypeController* dtc) OVERRIDE { | 425 DataTypeController* dtc) OVERRIDE { |
| 422 EXPECT_CALL(*factory, | 426 EXPECT_CALL(*factory, |
| 423 GetSyncableServiceForType(syncer::AUTOFILL_PROFILE)). | 427 GetSyncableServiceForType(syncer::AUTOFILL_PROFILE)). |
| 424 WillOnce(MakeAutofillProfileSyncComponents(wds)); | 428 WillOnce(MakeAutofillProfileSyncComponents(wds)); |
| 425 } | 429 } |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 std::vector<AutofillEntry> sync_entries; | 1387 std::vector<AutofillEntry> sync_entries; |
| 1384 std::vector<AutofillProfile> sync_profiles; | 1388 std::vector<AutofillProfile> sync_profiles; |
| 1385 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); | 1389 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); |
| 1386 EXPECT_EQ(3U, sync_entries.size()); | 1390 EXPECT_EQ(3U, sync_entries.size()); |
| 1387 EXPECT_EQ(0U, sync_profiles.size()); | 1391 EXPECT_EQ(0U, sync_profiles.size()); |
| 1388 for (size_t i = 0; i < sync_entries.size(); i++) { | 1392 for (size_t i = 0; i < sync_entries.size(); i++) { |
| 1389 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() | 1393 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() |
| 1390 << ", " << sync_entries[i].key().value(); | 1394 << ", " << sync_entries[i].key().value(); |
| 1391 } | 1395 } |
| 1392 } | 1396 } |
| OLD | NEW |