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

Unified Diff: chrome/browser/signin/local_auth_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
Index: chrome/browser/signin/local_auth_unittest.cc
diff --git a/chrome/browser/signin/local_auth_unittest.cc b/chrome/browser/signin/local_auth_unittest.cc
index 8aa0ddde28f38de2a66fbae6d16ba6b38b6659ee..e101f9d89d05f8b3ad1d795d78baf13ce41358f1 100644
--- a/chrome/browser/signin/local_auth_unittest.cc
+++ b/chrome/browser/signin/local_auth_unittest.cc
@@ -13,7 +13,7 @@
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
-#include "components/os_crypt/os_crypt.h"
+#include "components/os_crypt/os_crypt_mocker.h"
#include "components/prefs/pref_service.h"
#include "components/syncable_prefs/testing_pref_service_syncable.h"
#include "content/public/test/test_browser_thread_bundle.h"
@@ -21,6 +21,12 @@
#include "testing/gtest/include/gtest/gtest.h"
class LocalAuthTest : public testing::Test {
+ public:
+ LocalAuthTest() { OSCryptMocker::SetUpWithSingleton(); }
+
+ ~LocalAuthTest() override { OSCryptMocker::TearDown(); }
+
+ private:
content::TestBrowserThreadBundle thread_bundle_;
};
@@ -34,10 +40,6 @@ TEST_F(LocalAuthTest, SetAndCheckCredentials) {
GetProfileAttributesWithPath(prof->GetPath(), &entry));
EXPECT_EQ("", entry->GetLocalAuthCredentials());
-#if defined(OS_MACOSX)
- OSCrypt::UseMockKeychain(true);
-#endif
-
std::string password("Some Password");
EXPECT_FALSE(LocalAuth::ValidateLocalAuthCredentials(prof, password));
@@ -70,10 +72,6 @@ TEST_F(LocalAuthTest, SetUpgradeAndCheckCredentials) {
ASSERT_TRUE(testing_profile_manager.SetUp());
Profile* prof = testing_profile_manager.CreateTestingProfile("p1");
-#if defined(OS_MACOSX)
- OSCrypt::UseMockKeychain(true);
-#endif
-
std::string password("Some Password");
ProfileAttributesEntry* entry;
ASSERT_TRUE(testing_profile_manager.profile_attributes_storage()->

Powered by Google App Engine
This is Rietveld 408576698