OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/password_manager/password_store_proxy_mac.h" | 5 #include "chrome/browser/password_manager/password_store_proxy_mac.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/test/histogram_tester.h" | 15 #include "base/test/histogram_tester.h" |
16 #include "chrome/browser/password_manager/password_store_mac.h" | 16 #include "chrome/browser/password_manager/password_store_mac.h" |
17 #include "chrome/browser/password_manager/password_store_mac_internal.h" | 17 #include "chrome/browser/password_manager/password_store_mac_internal.h" |
18 #include "chrome/browser/prefs/browser_prefs.h" | 18 #include "chrome/browser/prefs/browser_prefs.h" |
19 #include "components/os_crypt/os_crypt_mocker.h" | 19 #include "components/os_crypt/os_crypt_mocker.h" |
20 #include "components/password_manager/core/browser/login_database.h" | 20 #include "components/password_manager/core/browser/login_database.h" |
21 #include "components/password_manager/core/browser/password_manager_test_utils.h
" | 21 #include "components/password_manager/core/browser/password_manager_test_utils.h
" |
22 #include "components/password_manager/core/browser/password_store_consumer.h" | 22 #include "components/password_manager/core/browser/password_store_consumer.h" |
23 #include "components/password_manager/core/common/password_manager_pref_names.h" | 23 #include "components/password_manager/core/common/password_manager_pref_names.h" |
24 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 24 #include "components/sync_preferences/testing_pref_service_syncable.h" |
25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
26 #include "content/public/test/test_browser_thread_bundle.h" | 26 #include "content/public/test/test_browser_thread_bundle.h" |
27 #include "crypto/mock_apple_keychain.h" | 27 #include "crypto/mock_apple_keychain.h" |
28 #include "testing/gmock/include/gmock/gmock.h" | 28 #include "testing/gmock/include/gmock/gmock.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
30 #include "url/origin.h" | 30 #include "url/origin.h" |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 using autofill::PasswordForm; | 34 using autofill::PasswordForm; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 return store_->login_metadata_db(); | 143 return store_->login_metadata_db(); |
144 } | 144 } |
145 | 145 |
146 PasswordStoreProxyMac* store() { return store_.get(); } | 146 PasswordStoreProxyMac* store() { return store_.get(); } |
147 | 147 |
148 protected: | 148 protected: |
149 content::TestBrowserThreadBundle ui_thread_; | 149 content::TestBrowserThreadBundle ui_thread_; |
150 | 150 |
151 base::ScopedTempDir db_dir_; | 151 base::ScopedTempDir db_dir_; |
152 scoped_refptr<PasswordStoreProxyMac> store_; | 152 scoped_refptr<PasswordStoreProxyMac> store_; |
153 syncable_prefs::TestingPrefServiceSyncable testing_prefs_; | 153 sync_preferences::TestingPrefServiceSyncable testing_prefs_; |
154 }; | 154 }; |
155 | 155 |
156 PasswordStoreProxyMacTest::PasswordStoreProxyMacTest() { | 156 PasswordStoreProxyMacTest::PasswordStoreProxyMacTest() { |
157 EXPECT_TRUE(db_dir_.CreateUniqueTempDir()); | 157 EXPECT_TRUE(db_dir_.CreateUniqueTempDir()); |
158 chrome::RegisterUserProfilePrefs(testing_prefs_.registry()); | 158 chrome::RegisterUserProfilePrefs(testing_prefs_.registry()); |
159 testing_prefs_.SetInteger(password_manager::prefs::kKeychainMigrationStatus, | 159 testing_prefs_.SetInteger(password_manager::prefs::kKeychainMigrationStatus, |
160 static_cast<int>(GetParam())); | 160 static_cast<int>(GetParam())); |
161 // Ensure that LoginDatabase will use the mock keychain if it needs to | 161 // Ensure that LoginDatabase will use the mock keychain if it needs to |
162 // encrypt/decrypt a password. | 162 // encrypt/decrypt a password. |
163 OSCryptMocker::SetUpWithSingleton(); | 163 OSCryptMocker::SetUpWithSingleton(); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 INSTANTIATE_TEST_CASE_P(, | 521 INSTANTIATE_TEST_CASE_P(, |
522 PasswordStoreProxyMacMigrationTest, | 522 PasswordStoreProxyMacMigrationTest, |
523 testing::Values(MigrationStatus::NOT_STARTED, | 523 testing::Values(MigrationStatus::NOT_STARTED, |
524 MigrationStatus::MIGRATED, | 524 MigrationStatus::MIGRATED, |
525 MigrationStatus::FAILED_ONCE, | 525 MigrationStatus::FAILED_ONCE, |
526 MigrationStatus::FAILED_TWICE, | 526 MigrationStatus::FAILED_TWICE, |
527 MigrationStatus::MIGRATED_DELETED, | 527 MigrationStatus::MIGRATED_DELETED, |
528 MigrationStatus::MIGRATED_PARTIALLY)); | 528 MigrationStatus::MIGRATED_PARTIALLY)); |
529 | 529 |
530 } // namespace | 530 } // namespace |
OLD | NEW |