| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
| 14 #include "base/test/test_timeouts.h" | 14 #include "base/test/test_timeouts.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/invalidation/invalidation_service_factory.h" | 17 #include "chrome/browser/invalidation/invalidation_service_factory.h" |
| 18 #include "chrome/browser/password_manager/mock_password_store.h" | 18 #include "chrome/browser/password_manager/mock_password_store.h" |
| 19 #include "chrome/browser/password_manager/mock_password_store_service.h" | 19 #include "chrome/browser/password_manager/mock_password_store_service.h" |
| 20 #include "chrome/browser/password_manager/null_password_store_service.h" | 20 #include "chrome/browser/password_manager/null_password_store_service.h" |
| 21 #include "chrome/browser/password_manager/password_store_factory.h" | 21 #include "chrome/browser/password_manager/password_store_factory.h" |
| 22 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 22 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 23 #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h" |
| 23 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 24 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
| 24 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 25 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 25 #include "chrome/browser/signin/signin_manager.h" | 26 #include "chrome/browser/signin/signin_manager.h" |
| 26 #include "chrome/browser/signin/signin_manager_factory.h" | 27 #include "chrome/browser/signin/signin_manager_factory.h" |
| 27 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" | 28 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" |
| 28 #include "chrome/browser/sync/glue/password_change_processor.h" | 29 #include "chrome/browser/sync/glue/password_change_processor.h" |
| 29 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 30 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
| 30 #include "chrome/browser/sync/glue/password_model_associator.h" | 31 #include "chrome/browser/sync/glue/password_model_associator.h" |
| 31 #include "chrome/browser/sync/profile_sync_components_factory.h" | 32 #include "chrome/browser/sync/profile_sync_components_factory.h" |
| 32 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 33 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 } | 154 } |
| 154 | 155 |
| 155 protected: | 156 protected: |
| 156 ProfileSyncServicePasswordTest() {} | 157 ProfileSyncServicePasswordTest() {} |
| 157 | 158 |
| 158 virtual void SetUp() { | 159 virtual void SetUp() { |
| 159 AbstractProfileSyncServiceTest::SetUp(); | 160 AbstractProfileSyncServiceTest::SetUp(); |
| 160 TestingProfile::Builder builder; | 161 TestingProfile::Builder builder; |
| 161 builder.AddTestingFactory( | 162 builder.AddTestingFactory( |
| 162 ProfileOAuth2TokenServiceFactory::GetInstance(), | 163 ProfileOAuth2TokenServiceFactory::GetInstance(), |
| 163 FakeProfileOAuth2TokenService::BuildAutoIssuingTokenService); | 164 FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService); |
| 164 profile_ = builder.Build().Pass(); | 165 profile_ = builder.Build().Pass(); |
| 165 invalidation::InvalidationServiceFactory::GetInstance()-> | 166 invalidation::InvalidationServiceFactory::GetInstance()-> |
| 166 SetBuildOnlyFakeInvalidatorsForTest(true); | 167 SetBuildOnlyFakeInvalidatorsForTest(true); |
| 167 PasswordStoreFactory* factory = PasswordStoreFactory::GetInstance(); | 168 PasswordStoreFactory* factory = PasswordStoreFactory::GetInstance(); |
| 168 factory->SetTestingFactory(profile_.get(), MockPasswordStoreService::Build); | 169 factory->SetTestingFactory(profile_.get(), MockPasswordStoreService::Build); |
| 169 scoped_refptr<PasswordStore> store_temp( | 170 scoped_refptr<PasswordStore> store_temp( |
| 170 factory->GetForProfile(profile_.get(), Profile::IMPLICIT_ACCESS)); | 171 factory->GetForProfile(profile_.get(), Profile::IMPLICIT_ACCESS)); |
| 171 password_store_ = static_cast<MockPasswordStore*>(store_temp.get()); | 172 password_store_ = static_cast<MockPasswordStore*>(store_temp.get()); |
| 172 } | 173 } |
| 173 | 174 |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 CreateRootHelper create_root(this, syncer::PASSWORDS); | 668 CreateRootHelper create_root(this, syncer::PASSWORDS); |
| 668 StartSyncService(create_root.callback(), | 669 StartSyncService(create_root.callback(), |
| 669 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); | 670 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); |
| 670 | 671 |
| 671 std::vector<PasswordForm> new_sync_forms; | 672 std::vector<PasswordForm> new_sync_forms; |
| 672 GetPasswordEntriesFromSyncDB(&new_sync_forms); | 673 GetPasswordEntriesFromSyncDB(&new_sync_forms); |
| 673 | 674 |
| 674 EXPECT_EQ(1U, new_sync_forms.size()); | 675 EXPECT_EQ(1U, new_sync_forms.size()); |
| 675 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); | 676 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); |
| 676 } | 677 } |
| OLD | NEW |