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

Unified Diff: components/sync_driver/system_encryptor_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/sync_driver/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync_driver/system_encryptor_unittest.cc
diff --git a/components/sync_driver/system_encryptor_unittest.cc b/components/sync_driver/system_encryptor_unittest.cc
index 2922834154ff1631e0b3b4358b70d079cec4ea55..bc4d7670a198388a777019df8e5dae9aa2325c58 100644
--- a/components/sync_driver/system_encryptor_unittest.cc
+++ b/components/sync_driver/system_encryptor_unittest.cc
@@ -7,7 +7,7 @@
#include <string>
#include "build/build_config.h"
-#include "components/os_crypt/os_crypt.h"
+#include "components/os_crypt/os_crypt_mocker.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace sync_driver {
@@ -22,17 +22,16 @@ class SystemEncryptorTest : public testing::Test {
};
TEST_F(SystemEncryptorTest, EncryptDecrypt) {
-#if defined(OS_MACOSX)
// SystemEncryptor ends up needing access to the keychain on OS X,
// so use the mock keychain to prevent prompts.
- ::OSCrypt::UseMockKeychain(true);
-#endif
+ ::OSCryptMocker::SetUpWithSingleton();
std::string ciphertext;
EXPECT_TRUE(encryptor_.EncryptString(kPlaintext, &ciphertext));
EXPECT_NE(kPlaintext, ciphertext);
std::string plaintext;
EXPECT_TRUE(encryptor_.DecryptString(ciphertext, &plaintext));
EXPECT_EQ(kPlaintext, plaintext);
+ ::OSCryptMocker::TearDown();
}
} // namespace
« no previous file with comments | « components/sync_driver/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698