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

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

Issue 2010463002: Mocker for OSCrypt (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated doc Created 4 years, 7 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/BUILD.gn ('k') | components/signin/core/browser/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « components/password_manager/core/browser/BUILD.gn ('k') | components/signin/core/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698