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