Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Unified Diff: components/password_manager/core/browser/password_store_unittest.cc

Issue 2743243005: Initialize PasswordReuseDetector on PasswordStore initialization on Mac. (Closed)
Patch Set: Added comment Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/password_manager/core/browser/password_store.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/core/browser/password_store_unittest.cc
diff --git a/components/password_manager/core/browser/password_store_unittest.cc b/components/password_manager/core/browser/password_store_unittest.cc
index c47fcebe9fdb23d119980f931e7608a51e20903f..9a16268919ce7b60641ae57527a825f27d42bef3 100644
--- a/components/password_manager/core/browser/password_store_unittest.cc
+++ b/components/password_manager/core/browser/password_store_unittest.cc
@@ -31,6 +31,10 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#if defined(OS_MACOSX)
+#include "components/os_crypt/os_crypt_mocker.h"
+#endif
+
using autofill::PasswordForm;
using base::WaitableEvent;
using testing::_;
@@ -840,9 +844,6 @@ TEST_F(PasswordStoreTest, GetLoginsWithAffiliatedRealms) {
}
}
-#if !defined(OS_MACOSX)
-// TODO(crbug.com/668155): Enable this test after fixing issues with
-// initialization PasswordStore with MockKeyChain in tests on MacOS.
TEST_F(PasswordStoreTest, CheckPasswordReuse) {
static constexpr PasswordFormData kTestCredentials[] = {
{PasswordForm::SCHEME_HTML, "https://www.google.com",
@@ -850,6 +851,11 @@ TEST_F(PasswordStoreTest, CheckPasswordReuse) {
{PasswordForm::SCHEME_HTML, "https://facebook.com",
"https://facebook.com", "", L"", L"", L"", L"", L"topsecret", true, 1}};
+#if defined(OS_MACOSX)
+ // Mock Keychain. There is a call to Keychain on initializling
+ // PasswordReuseDetector, so it should be mocked.
+ OSCryptMocker::SetUpWithSingleton();
+#endif
scoped_refptr<PasswordStoreDefault> store(new PasswordStoreDefault(
base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(),
base::MakeUnique<LoginDatabase>(test_login_db_file_path())));
@@ -889,7 +895,9 @@ TEST_F(PasswordStoreTest, CheckPasswordReuse) {
store->ShutdownOnUIThread();
base::RunLoop().RunUntilIdle();
-}
+#if defined(OS_MACOSX)
+ OSCryptMocker::TearDown();
#endif
+}
} // namespace password_manager
« no previous file with comments | « components/password_manager/core/browser/password_store.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698