| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 373     EXPECT_CALL(*personal_data_manager_, LoadProfiles()).Times(1); | 373     EXPECT_CALL(*personal_data_manager_, LoadProfiles()).Times(1); | 
| 374     EXPECT_CALL(*personal_data_manager_, LoadCreditCards()).Times(1); | 374     EXPECT_CALL(*personal_data_manager_, LoadCreditCards()).Times(1); | 
| 375     EXPECT_CALL(profile_, GetWebDataService(_)). | 375     EXPECT_CALL(profile_, GetWebDataService(_)). | 
| 376         // TokenService::Initialize | 376         // TokenService::Initialize | 
| 377         // AutofillDataTypeController::StartModels() | 377         // AutofillDataTypeController::StartModels() | 
| 378         // In some tests: | 378         // In some tests: | 
| 379         // AutofillProfileSyncableService::AutofillProfileSyncableService() | 379         // AutofillProfileSyncableService::AutofillProfileSyncableService() | 
| 380         WillRepeatedly(Return(web_data_service_.get())); | 380         WillRepeatedly(Return(web_data_service_.get())); | 
| 381     personal_data_manager_->Init(&profile_); | 381     personal_data_manager_->Init(&profile_); | 
| 382 | 382 | 
| 383     notification_service_ = new ThreadNotificationService( |  | 
| 384         db_thread_.DeprecatedGetThreadObject()); |  | 
| 385     notification_service_->Init(); |  | 
| 386 |  | 
| 387     // Note: This must be called *after* the notification service is created. | 383     // Note: This must be called *after* the notification service is created. | 
| 388     web_data_service_->StartSyncableService(); | 384     web_data_service_->StartSyncableService(); | 
| 389   } | 385   } | 
| 390 | 386 | 
| 391   virtual void TearDown() OVERRIDE { | 387   virtual void TearDown() OVERRIDE { | 
| 392     // Note: The tear down order is important. | 388     // Note: The tear down order is important. | 
| 393     service_.reset(); | 389     service_.reset(); | 
| 394     web_data_service_->ShutdownSyncableService(); | 390     web_data_service_->ShutdownSyncableService(); | 
| 395     notification_service_->TearDown(); |  | 
| 396     profile_.ResetRequestContext(); | 391     profile_.ResetRequestContext(); | 
| 397     AbstractProfileSyncServiceTest::TearDown(); | 392     AbstractProfileSyncServiceTest::TearDown(); | 
| 398   } | 393   } | 
| 399 | 394 | 
| 400   void StartSyncService(const base::Closure& callback, | 395   void StartSyncService(const base::Closure& callback, | 
| 401                         bool will_fail_association, | 396                         bool will_fail_association, | 
| 402                         syncable::ModelType type) { | 397                         syncable::ModelType type) { | 
| 403     AbstractAutofillFactory* factory = GetFactory(type); | 398     AbstractAutofillFactory* factory = GetFactory(type); | 
| 404     SigninManager* signin = SigninManagerFactory::GetForProfile(&profile_); | 399     SigninManager* signin = SigninManagerFactory::GetForProfile(&profile_); | 
| 405     signin->SetAuthenticatedUsername("test_user"); | 400     signin->SetAuthenticatedUsername("test_user"); | 
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 565   static AutofillEntry MakeAutofillEntry(const char* name, | 560   static AutofillEntry MakeAutofillEntry(const char* name, | 
| 566                                          const char* value, | 561                                          const char* value, | 
| 567                                          time_t timestamp) { | 562                                          time_t timestamp) { | 
| 568     return MakeAutofillEntry(name, value, timestamp, -1); | 563     return MakeAutofillEntry(name, value, timestamp, -1); | 
| 569   } | 564   } | 
| 570 | 565 | 
| 571   friend class AddAutofillHelper<AutofillEntry>; | 566   friend class AddAutofillHelper<AutofillEntry>; | 
| 572   friend class AddAutofillHelper<AutofillProfile>; | 567   friend class AddAutofillHelper<AutofillProfile>; | 
| 573   friend class FakeServerUpdater; | 568   friend class FakeServerUpdater; | 
| 574 | 569 | 
| 575   scoped_refptr<ThreadNotificationService> notification_service_; |  | 
| 576 |  | 
| 577   ProfileMock profile_; | 570   ProfileMock profile_; | 
| 578   AutofillTableMock autofill_table_; | 571   AutofillTableMock autofill_table_; | 
| 579   scoped_ptr<WebDatabaseFake> web_database_; | 572   scoped_ptr<WebDatabaseFake> web_database_; | 
| 580   scoped_refptr<WebDataServiceFake> web_data_service_; | 573   scoped_refptr<WebDataServiceFake> web_data_service_; | 
| 581   PersonalDataManagerMock* personal_data_manager_; | 574   PersonalDataManagerMock* personal_data_manager_; | 
| 582 }; | 575 }; | 
| 583 | 576 | 
| 584 template <class T> | 577 template <class T> | 
| 585 class AddAutofillHelper { | 578 class AddAutofillHelper { | 
| 586  public: | 579  public: | 
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1239   std::vector<AutofillEntry> sync_entries; | 1232   std::vector<AutofillEntry> sync_entries; | 
| 1240   std::vector<AutofillProfile> sync_profiles; | 1233   std::vector<AutofillProfile> sync_profiles; | 
| 1241   ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); | 1234   ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); | 
| 1242   EXPECT_EQ(3U, sync_entries.size()); | 1235   EXPECT_EQ(3U, sync_entries.size()); | 
| 1243   EXPECT_EQ(0U, sync_profiles.size()); | 1236   EXPECT_EQ(0U, sync_profiles.size()); | 
| 1244   for (size_t i = 0; i < sync_entries.size(); i++) { | 1237   for (size_t i = 0; i < sync_entries.size(); i++) { | 
| 1245     DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() | 1238     DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() | 
| 1246              << ", " << sync_entries[i].key().value(); | 1239              << ", " << sync_entries[i].key().value(); | 
| 1247   } | 1240   } | 
| 1248 } | 1241 } | 
| OLD | NEW | 
|---|