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 <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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 static_cast<MockPersonalDataManagerService*>( | 482 static_cast<MockPersonalDataManagerService*>( |
483 autofill::PersonalDataManagerFactory::GetInstance() | 483 autofill::PersonalDataManagerFactory::GetInstance() |
484 ->SetTestingFactoryAndUse( | 484 ->SetTestingFactoryAndUse( |
485 profile_.get(), MockPersonalDataManagerService::Build)); | 485 profile_.get(), MockPersonalDataManagerService::Build)); |
486 personal_data_manager_ = | 486 personal_data_manager_ = |
487 personal_data_manager_service->GetPersonalDataManager(); | 487 personal_data_manager_service->GetPersonalDataManager(); |
488 | 488 |
489 token_service_ = static_cast<TokenService*>( | 489 token_service_ = static_cast<TokenService*>( |
490 TokenServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 490 TokenServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
491 profile_.get(), BuildTokenService)); | 491 profile_.get(), BuildTokenService)); |
| 492 ProfileOAuth2TokenServiceFactory::GetInstance()->SetTestingFactory( |
| 493 profile_.get(), FakeOAuth2TokenService::BuildTokenService); |
492 EXPECT_CALL(*personal_data_manager_, LoadProfiles()).Times(1); | 494 EXPECT_CALL(*personal_data_manager_, LoadProfiles()).Times(1); |
493 EXPECT_CALL(*personal_data_manager_, LoadCreditCards()).Times(1); | 495 EXPECT_CALL(*personal_data_manager_, LoadCreditCards()).Times(1); |
494 | 496 |
495 personal_data_manager_->Init(profile_.get()); | 497 personal_data_manager_->Init(profile_.get()); |
496 | 498 |
497 web_data_service_->StartSyncableService(); | 499 web_data_service_->StartSyncableService(); |
498 } | 500 } |
499 | 501 |
500 virtual void TearDown() OVERRIDE { | 502 virtual void TearDown() OVERRIDE { |
501 // Note: The tear down order is important. | 503 // Note: The tear down order is important. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 data_type_controller); | 545 data_type_controller); |
544 | 546 |
545 EXPECT_CALL(*components, CreateDataTypeManager(_, _, _, _, _)). | 547 EXPECT_CALL(*components, CreateDataTypeManager(_, _, _, _, _)). |
546 WillOnce(ReturnNewDataTypeManagerWithDebugListener( | 548 WillOnce(ReturnNewDataTypeManagerWithDebugListener( |
547 syncer::MakeWeakHandle(debug_ptr_factory_.GetWeakPtr()))); | 549 syncer::MakeWeakHandle(debug_ptr_factory_.GetWeakPtr()))); |
548 | 550 |
549 EXPECT_CALL(*personal_data_manager_, IsDataLoaded()). | 551 EXPECT_CALL(*personal_data_manager_, IsDataLoaded()). |
550 WillRepeatedly(Return(true)); | 552 WillRepeatedly(Return(true)); |
551 | 553 |
552 // We need tokens to get the tests going | 554 // We need tokens to get the tests going |
553 token_service_->IssueAuthTokenForTest(GaiaConstants::kSyncService, "token"); | 555 token_service_->IssueAuthTokenForTest( |
| 556 GaiaConstants::kGaiaOAuth2LoginRefreshToken, "oauth2_login_token"); |
554 | 557 |
555 sync_service_->RegisterDataTypeController(data_type_controller); | 558 sync_service_->RegisterDataTypeController(data_type_controller); |
556 sync_service_->Initialize(); | 559 sync_service_->Initialize(); |
557 MessageLoop::current()->Run(); | 560 MessageLoop::current()->Run(); |
558 | 561 |
559 // It's possible this test triggered an unrecoverable error, in which case | 562 // It's possible this test triggered an unrecoverable error, in which case |
560 // we can't get the sync count. | 563 // we can't get the sync count. |
561 if (sync_service_->ShouldPushChanges()) { | 564 if (sync_service_->ShouldPushChanges()) { |
562 EXPECT_EQ(GetSyncCount(type), | 565 EXPECT_EQ(GetSyncCount(type), |
563 association_stats_.num_sync_items_after_association); | 566 association_stats_.num_sync_items_after_association); |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 std::vector<AutofillEntry> sync_entries; | 1367 std::vector<AutofillEntry> sync_entries; |
1365 std::vector<AutofillProfile> sync_profiles; | 1368 std::vector<AutofillProfile> sync_profiles; |
1366 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); | 1369 ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles)); |
1367 EXPECT_EQ(3U, sync_entries.size()); | 1370 EXPECT_EQ(3U, sync_entries.size()); |
1368 EXPECT_EQ(0U, sync_profiles.size()); | 1371 EXPECT_EQ(0U, sync_profiles.size()); |
1369 for (size_t i = 0; i < sync_entries.size(); i++) { | 1372 for (size_t i = 0; i < sync_entries.size(); i++) { |
1370 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() | 1373 DVLOG(1) << "Entry " << i << ": " << sync_entries[i].key().name() |
1371 << ", " << sync_entries[i].key().value(); | 1374 << ", " << sync_entries[i].key().value(); |
1372 } | 1375 } |
1373 } | 1376 } |
OLD | NEW |