Index: components/password_manager/core/browser/login_database_unittest.cc |
diff --git a/components/password_manager/core/browser/login_database_unittest.cc b/components/password_manager/core/browser/login_database_unittest.cc |
index 8b1999ede9d43fe1e1f00f24b5de42b0c9718145..5c7fceac72e53a0c9f64cd0a2a1cc2cfb5a0aa09 100644 |
--- a/components/password_manager/core/browser/login_database_unittest.cc |
+++ b/components/password_manager/core/browser/login_database_unittest.cc |
@@ -8,6 +8,7 @@ |
#include <stdint.h> |
#include <memory> |
+#include <utility> |
#include "base/files/file_util.h" |
#include "base/files/scoped_temp_dir.h" |
@@ -20,6 +21,7 @@ |
#include "base/time/time.h" |
#include "build/build_config.h" |
#include "components/autofill/core/common/password_form.h" |
+#include "components/os_crypt/os_crypt_mocker.h" |
#include "components/password_manager/core/browser/psl_matching_helper.h" |
#include "sql/connection.h" |
#include "sql/statement.h" |
@@ -28,10 +30,6 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
#include "url/origin.h" |
-#if defined(OS_MACOSX) |
-#include "components/os_crypt/os_crypt.h" |
-#endif |
- |
using autofill::PasswordForm; |
using base::ASCIIToUTF16; |
using ::testing::Eq; |
@@ -83,11 +81,11 @@ template<class T> T GetFirstColumn(const sql::Statement& s) { |
template<> int64_t GetFirstColumn(const sql::Statement& s) { |
return s.ColumnInt64(0); |
-}; |
+} |
template<> std::string GetFirstColumn(const sql::Statement& s) { |
return s.ColumnString(0); |
-}; |
+} |
bool AddZeroClickableLogin(LoginDatabase* db, |
const std::string& unique_string) { |
@@ -120,14 +118,14 @@ class LoginDatabaseTest : public testing::Test { |
void SetUp() override { |
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
file_ = temp_dir_.path().AppendASCII("TestMetadataStoreMacDatabase"); |
-#if defined(OS_MACOSX) |
- OSCrypt::UseMockKeychain(true); |
-#endif // defined(OS_MACOSX) |
+ OSCryptMocker::SetUpWithSingleton(); |
db_.reset(new LoginDatabase(file_)); |
ASSERT_TRUE(db_->Init()); |
} |
+ void TearDown() override { OSCryptMocker::TearDown(); } |
+ |
LoginDatabase& db() { return *db_; } |
void TestNonHTMLFormPSLMatching(const PasswordForm::Scheme& scheme) { |
@@ -1503,11 +1501,11 @@ class LoginDatabaseMigrationTest : public testing::TestWithParam<int> { |
.AppendASCII("data") |
.AppendASCII("password_manager"); |
database_path_ = temp_dir_.path().AppendASCII("test.db"); |
-#if defined(OS_MACOSX) |
- OSCrypt::UseMockKeychain(true); |
-#endif // defined(OS_MACOSX) |
+ OSCryptMocker::SetUpWithSingleton(); |
} |
+ void TearDown() override { OSCryptMocker::TearDown(); } |
+ |
// Creates the databse from |sql_file|. |
void CreateDatabase(base::StringPiece sql_file) { |
base::FilePath database_dump; |