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

Side by Side Diff: components/browser_sync/profile_sync_service_autofill_unittest.cc

Issue 2376123003: [Sync] Move //components/sync to the syncer namespace. (Closed)
Patch Set: Fix tools and iOS. Created 4 years, 2 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
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 357
358 WaitableEvent syncable_service_created_or_destroyed_; 358 WaitableEvent syncable_service_created_or_destroyed_;
359 359
360 const scoped_refptr<base::SingleThreadTaskRunner> db_thread_; 360 const scoped_refptr<base::SingleThreadTaskRunner> db_thread_;
361 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; 361 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_;
362 362
363 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFake); 363 DISALLOW_COPY_AND_ASSIGN(WebDataServiceFake);
364 }; 364 };
365 365
366 ACTION_P(ReturnNewDataTypeManagerWithDebugListener, debug_listener) { 366 ACTION_P(ReturnNewDataTypeManagerWithDebugListener, debug_listener) {
367 return new sync_driver::DataTypeManagerImpl(debug_listener, arg1, arg2, arg3, 367 return new syncer::DataTypeManagerImpl(debug_listener, arg1, arg2, arg3,
368 arg4); 368 arg4);
369 } 369 }
370 370
371 class MockPersonalDataManager : public PersonalDataManager { 371 class MockPersonalDataManager : public PersonalDataManager {
372 public: 372 public:
373 MockPersonalDataManager() : PersonalDataManager("en-US") {} 373 MockPersonalDataManager() : PersonalDataManager("en-US") {}
374 MOCK_CONST_METHOD0(IsDataLoaded, bool()); 374 MOCK_CONST_METHOD0(IsDataLoaded, bool());
375 MOCK_METHOD0(LoadProfiles, void()); 375 MOCK_METHOD0(LoadProfiles, void());
376 MOCK_METHOD0(LoadCreditCards, void()); 376 MOCK_METHOD0(LoadCreditCards, void());
377 MOCK_METHOD0(Refresh, void()); 377 MOCK_METHOD0(Refresh, void());
378 }; 378 };
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 596
597 void SetIdleChangeProcessorExpectations() { 597 void SetIdleChangeProcessorExpectations() {
598 EXPECT_CALL(autofill_table_, RemoveFormElement(_, _)).Times(0); 598 EXPECT_CALL(autofill_table_, RemoveFormElement(_, _)).Times(0);
599 EXPECT_CALL(autofill_table_, GetAutofillTimestamps(_, _, _, _)).Times(0); 599 EXPECT_CALL(autofill_table_, GetAutofillTimestamps(_, _, _, _)).Times(0);
600 600
601 // Only permit UpdateAutofillEntries() to be called with an empty list. 601 // Only permit UpdateAutofillEntries() to be called with an empty list.
602 std::vector<AutofillEntry> empty; 602 std::vector<AutofillEntry> empty;
603 EXPECT_CALL(autofill_table_, UpdateAutofillEntries(Not(empty))).Times(0); 603 EXPECT_CALL(autofill_table_, UpdateAutofillEntries(Not(empty))).Times(0);
604 } 604 }
605 605
606 std::unique_ptr<sync_driver::DataTypeController> CreateDataTypeController( 606 std::unique_ptr<syncer::DataTypeController> CreateDataTypeController(
607 syncer::ModelType type) { 607 syncer::ModelType type) {
608 DCHECK(type == AUTOFILL || type == AUTOFILL_PROFILE); 608 DCHECK(type == AUTOFILL || type == AUTOFILL_PROFILE);
609 if (type == AUTOFILL) { 609 if (type == AUTOFILL) {
610 return base::MakeUnique<AutofillDataTypeController>( 610 return base::MakeUnique<AutofillDataTypeController>(
611 data_type_thread()->task_runner(), base::Bind(&base::DoNothing), 611 data_type_thread()->task_runner(), base::Bind(&base::DoNothing),
612 sync_client_, web_data_service_); 612 sync_client_, web_data_service_);
613 } else { 613 } else {
614 return base::MakeUnique<AutofillProfileDataTypeController>( 614 return base::MakeUnique<AutofillProfileDataTypeController>(
615 data_type_thread()->task_runner(), base::Bind(&base::DoNothing), 615 data_type_thread()->task_runner(), base::Bind(&base::DoNothing),
616 sync_client_, web_data_service_); 616 sync_client_, web_data_service_);
(...skipping 29 matching lines...) Expand all
646 AutofillTableMock autofill_table_; 646 AutofillTableMock autofill_table_;
647 std::unique_ptr<WebDatabaseFake> web_database_; 647 std::unique_ptr<WebDatabaseFake> web_database_;
648 std::unique_ptr<MockWebDataServiceWrapper> web_data_wrapper_; 648 std::unique_ptr<MockWebDataServiceWrapper> web_data_wrapper_;
649 scoped_refptr<WebDataServiceFake> web_data_service_; 649 scoped_refptr<WebDataServiceFake> web_data_service_;
650 std::unique_ptr<MockPersonalDataManager> personal_data_manager_; 650 std::unique_ptr<MockPersonalDataManager> personal_data_manager_;
651 syncer::DataTypeAssociationStats association_stats_; 651 syncer::DataTypeAssociationStats association_stats_;
652 base::WeakPtrFactory<DataTypeDebugInfoListener> debug_ptr_factory_; 652 base::WeakPtrFactory<DataTypeDebugInfoListener> debug_ptr_factory_;
653 // |sync_client_owned_| keeps the created client until it is passed to the 653 // |sync_client_owned_| keeps the created client until it is passed to the
654 // created ProfileSyncService. |sync_client_| just keeps a weak reference to 654 // created ProfileSyncService. |sync_client_| just keeps a weak reference to
655 // the client the whole time. 655 // the client the whole time.
656 std::unique_ptr<sync_driver::FakeSyncClient> sync_client_owned_; 656 std::unique_ptr<syncer::FakeSyncClient> sync_client_owned_;
657 sync_driver::FakeSyncClient* sync_client_; 657 syncer::FakeSyncClient* sync_client_;
658 658
659 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceAutofillTest); 659 DISALLOW_COPY_AND_ASSIGN(ProfileSyncServiceAutofillTest);
660 }; 660 };
661 661
662 template <class T> 662 template <class T>
663 class AddAutofillHelper { 663 class AddAutofillHelper {
664 public: 664 public:
665 AddAutofillHelper(ProfileSyncServiceAutofillTest* test, 665 AddAutofillHelper(ProfileSyncServiceAutofillTest* test,
666 const std::vector<T>& entries) 666 const std::vector<T>& entries)
667 : callback_(base::Bind(&AddAutofillHelper::AddAutofillCallback, 667 : callback_(base::Bind(&AddAutofillHelper::AddAutofillCallback,
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); 1465 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles));
1466 EXPECT_EQ(3U, sync_entries.size()); 1466 EXPECT_EQ(3U, sync_entries.size());
1467 EXPECT_EQ(0U, sync_profiles.size()); 1467 EXPECT_EQ(0U, sync_profiles.size());
1468 for (size_t i = 0; i < sync_entries.size(); i++) { 1468 for (size_t i = 0; i < sync_entries.size(); i++) {
1469 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() << ", " 1469 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() << ", "
1470 << sync_entries[i].key().value(); 1470 << sync_entries[i].key().value();
1471 } 1471 }
1472 } 1472 }
1473 1473
1474 } // namespace browser_sync 1474 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698