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" |
| 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
21 #include "chrome/browser/signin/signin_manager.h" | 23 #include "chrome/browser/signin/signin_manager.h" |
22 #include "chrome/browser/signin/signin_manager_factory.h" | 24 #include "chrome/browser/signin/signin_manager_factory.h" |
23 #include "chrome/browser/signin/token_service_factory.h" | 25 #include "chrome/browser/signin/token_service_factory.h" |
24 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" | 26 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" |
25 #include "chrome/browser/sync/fake_oauth2_token_service.h" | 27 #include "chrome/browser/sync/fake_oauth2_token_service.h" |
26 #include "chrome/browser/sync/glue/password_change_processor.h" | 28 #include "chrome/browser/sync/glue/password_change_processor.h" |
27 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 29 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
28 #include "chrome/browser/sync/glue/password_model_associator.h" | 30 #include "chrome/browser/sync/glue/password_model_associator.h" |
29 #include "chrome/browser/sync/profile_sync_components_factory.h" | 31 #include "chrome/browser/sync/profile_sync_components_factory.h" |
30 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 32 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
31 #include "chrome/browser/sync/profile_sync_service.h" | 33 #include "chrome/browser/sync/profile_sync_service.h" |
32 #include "chrome/browser/sync/profile_sync_service_factory.h" | 34 #include "chrome/browser/sync/profile_sync_service_factory.h" |
33 #include "chrome/browser/sync/profile_sync_test_util.h" | 35 #include "chrome/browser/sync/profile_sync_test_util.h" |
34 #include "chrome/browser/sync/test_profile_sync_service.h" | 36 #include "chrome/browser/sync/test_profile_sync_service.h" |
35 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
| 38 #include "chrome/test/base/testing_profile.h" |
36 #include "components/autofill/core/common/password_form.h" | 39 #include "components/autofill/core/common/password_form.h" |
37 #include "content/public/browser/notification_source.h" | 40 #include "content/public/browser/notification_source.h" |
38 #include "content/public/test/mock_notification_observer.h" | 41 #include "content/public/test/mock_notification_observer.h" |
39 #include "content/public/test/test_browser_thread.h" | 42 #include "content/public/test/test_browser_thread.h" |
40 #include "google_apis/gaia/gaia_constants.h" | 43 #include "google_apis/gaia/gaia_constants.h" |
41 #include "sync/internal_api/public/read_node.h" | 44 #include "sync/internal_api/public/read_node.h" |
42 #include "sync/internal_api/public/read_transaction.h" | 45 #include "sync/internal_api/public/read_transaction.h" |
43 #include "sync/internal_api/public/write_node.h" | 46 #include "sync/internal_api/public/write_node.h" |
44 #include "sync/internal_api/public/write_transaction.h" | 47 #include "sync/internal_api/public/write_transaction.h" |
45 #include "sync/protocol/password_specifics.pb.h" | 48 #include "sync/protocol/password_specifics.pb.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 public: | 98 public: |
96 PasswordTestProfileSyncService( | 99 PasswordTestProfileSyncService( |
97 ProfileSyncComponentsFactory* factory, | 100 ProfileSyncComponentsFactory* factory, |
98 Profile* profile, | 101 Profile* profile, |
99 SigninManagerBase* signin, | 102 SigninManagerBase* signin, |
100 ProfileOAuth2TokenService* oauth2_token_service) | 103 ProfileOAuth2TokenService* oauth2_token_service) |
101 : TestProfileSyncService(factory, | 104 : TestProfileSyncService(factory, |
102 profile, | 105 profile, |
103 signin, | 106 signin, |
104 oauth2_token_service, | 107 oauth2_token_service, |
105 ProfileSyncService::AUTO_START, | 108 ProfileSyncService::AUTO_START) {} |
106 false) {} | |
107 | 109 |
108 virtual ~PasswordTestProfileSyncService() {} | 110 virtual ~PasswordTestProfileSyncService() {} |
109 | 111 |
110 virtual void OnPassphraseAccepted() OVERRIDE { | 112 virtual void OnPassphraseAccepted() OVERRIDE { |
111 if (!callback_.is_null()) | 113 if (!callback_.is_null()) |
112 callback_.Run(); | 114 callback_.Run(); |
113 | 115 |
114 TestProfileSyncService::OnPassphraseAccepted(); | 116 TestProfileSyncService::OnPassphraseAccepted(); |
115 } | 117 } |
116 | 118 |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 CreateRootHelper create_root(this, syncer::PASSWORDS); | 654 CreateRootHelper create_root(this, syncer::PASSWORDS); |
653 StartSyncService(create_root.callback(), | 655 StartSyncService(create_root.callback(), |
654 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); | 656 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); |
655 | 657 |
656 std::vector<PasswordForm> new_sync_forms; | 658 std::vector<PasswordForm> new_sync_forms; |
657 GetPasswordEntriesFromSyncDB(&new_sync_forms); | 659 GetPasswordEntriesFromSyncDB(&new_sync_forms); |
658 | 660 |
659 EXPECT_EQ(1U, new_sync_forms.size()); | 661 EXPECT_EQ(1U, new_sync_forms.size()); |
660 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); | 662 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); |
661 } | 663 } |
OLD | NEW |