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