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/password_store.h" | 19 #include "chrome/browser/password_manager/password_store.h" |
20 #include "chrome/browser/password_manager/password_store_factory.h" | 20 #include "chrome/browser/password_manager/password_store_factory.h" |
21 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 21 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
23 #include "chrome/browser/signin/signin_manager.h" | 23 #include "chrome/browser/signin/signin_manager.h" |
24 #include "chrome/browser/signin/signin_manager_factory.h" | 24 #include "chrome/browser/signin/signin_manager_factory.h" |
25 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" | 25 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" |
26 #include "chrome/browser/sync/fake_oauth2_token_service.h" | 26 #include "chrome/browser/sync/fake_oauth2_token_service_for_sync.h" |
27 #include "chrome/browser/sync/glue/password_change_processor.h" | 27 #include "chrome/browser/sync/glue/password_change_processor.h" |
28 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 28 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
29 #include "chrome/browser/sync/glue/password_model_associator.h" | 29 #include "chrome/browser/sync/glue/password_model_associator.h" |
30 #include "chrome/browser/sync/profile_sync_components_factory.h" | 30 #include "chrome/browser/sync/profile_sync_components_factory.h" |
31 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 31 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
32 #include "chrome/browser/sync/profile_sync_service.h" | 32 #include "chrome/browser/sync/profile_sync_service.h" |
33 #include "chrome/browser/sync/profile_sync_service_factory.h" | 33 #include "chrome/browser/sync/profile_sync_service_factory.h" |
34 #include "chrome/browser/sync/profile_sync_test_util.h" | 34 #include "chrome/browser/sync/profile_sync_test_util.h" |
35 #include "chrome/browser/sync/test_profile_sync_service.h" | 35 #include "chrome/browser/sync/test_profile_sync_service.h" |
36 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 PasswordModelAssociator::WriteToSyncNode(entry, &node); | 156 PasswordModelAssociator::WriteToSyncNode(entry, &node); |
157 } | 157 } |
158 | 158 |
159 protected: | 159 protected: |
160 ProfileSyncServicePasswordTest() {} | 160 ProfileSyncServicePasswordTest() {} |
161 | 161 |
162 virtual void SetUp() { | 162 virtual void SetUp() { |
163 AbstractProfileSyncServiceTest::SetUp(); | 163 AbstractProfileSyncServiceTest::SetUp(); |
164 TestingProfile::Builder builder; | 164 TestingProfile::Builder builder; |
165 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), | 165 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), |
166 FakeOAuth2TokenService::BuildTokenService); | 166 FakeOAuth2TokenServiceForSync::BuildTokenService); |
167 profile_ = builder.Build().Pass(); | 167 profile_ = builder.Build().Pass(); |
168 invalidation::InvalidationServiceFactory::GetInstance()-> | 168 invalidation::InvalidationServiceFactory::GetInstance()-> |
169 SetBuildOnlyFakeInvalidatorsForTest(true); | 169 SetBuildOnlyFakeInvalidatorsForTest(true); |
170 password_store_ = static_cast<MockPasswordStore*>( | 170 password_store_ = static_cast<MockPasswordStore*>( |
171 PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse( | 171 PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse( |
172 profile_.get(), MockPasswordStore::Build).get()); | 172 profile_.get(), MockPasswordStore::Build).get()); |
173 } | 173 } |
174 | 174 |
175 virtual void TearDown() { | 175 virtual void TearDown() { |
176 if (password_store_.get()) | 176 if (password_store_.get()) |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 CreateRootHelper create_root(this, syncer::PASSWORDS); | 651 CreateRootHelper create_root(this, syncer::PASSWORDS); |
652 StartSyncService(create_root.callback(), | 652 StartSyncService(create_root.callback(), |
653 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); | 653 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); |
654 | 654 |
655 std::vector<PasswordForm> new_sync_forms; | 655 std::vector<PasswordForm> new_sync_forms; |
656 GetPasswordEntriesFromSyncDB(&new_sync_forms); | 656 GetPasswordEntriesFromSyncDB(&new_sync_forms); |
657 | 657 |
658 EXPECT_EQ(1U, new_sync_forms.size()); | 658 EXPECT_EQ(1U, new_sync_forms.size()); |
659 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); | 659 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); |
660 } | 660 } |
OLD | NEW |