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

Unified Diff: chrome/browser/password_manager/password_store_mac_unittest.cc

Issue 1192493005: Encrypt password values in LoginDatabase on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 5 years, 6 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/password_manager/password_store_mac_unittest.cc
diff --git a/chrome/browser/password_manager/password_store_mac_unittest.cc b/chrome/browser/password_manager/password_store_mac_unittest.cc
index ccd0cee719cd3f982fb3ecdbb6561ef3de22db1a..73443cc01317cb0d9444b4833bbb5886814f10e9 100644
--- a/chrome/browser/password_manager/password_store_mac_unittest.cc
+++ b/chrome/browser/password_manager/password_store_mac_unittest.cc
@@ -11,9 +11,11 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/waitable_event.h"
+#include "base/test/histogram_tester.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/password_manager/password_store_mac_internal.h"
#include "chrome/common/chrome_paths.h"
+#include "components/os_crypt/os_crypt.h"
#include "components/password_manager/core/browser/login_database.h"
#include "components/password_manager/core/browser/password_manager_test_utils.h"
#include "components/password_manager/core/browser/password_store_consumer.h"
@@ -1205,6 +1207,9 @@ class PasswordStoreMacTest : public testing::Test {
void SetUp() override {
ASSERT_TRUE(db_dir_.CreateUniqueTempDir());
+ // Ensure that LoginDatabase will use the mock keychain if it needs to
+ // encrypt/decrypt a password.
+ OSCrypt::UseMockKeychain(true);
scoped_ptr<password_manager::LoginDatabase> login_db(
new password_manager::LoginDatabase(test_login_db_file_path()));
CreateAndInitPasswordStore(login_db.Pass());
@@ -1213,7 +1218,15 @@ class PasswordStoreMacTest : public testing::Test {
FinishAsyncProcessing();
}
- void TearDown() override { ClosePasswordStore(); }
+ void TearDown() override {
+ ClosePasswordStore();
+ // Whatever a test did, PasswordStoreMac stores only empty password values
+ // in LoginDatabase. The empty valus do not require encryption and therefore
+ // OSCrypt shouldn't call the Keychain. The histogram doesn't cover the
+ // internet passwords.
+ EXPECT_FALSE(histogram_tester_.GetHistogramSamplesSinceCreation(
+ "OSX.Keychain.Access"));
+ }
void CreateAndInitPasswordStore(
scoped_ptr<password_manager::LoginDatabase> login_db) {
@@ -1314,6 +1327,7 @@ class PasswordStoreMacTest : public testing::Test {
base::ScopedTempDir db_dir_;
scoped_refptr<TestPasswordStoreMac> store_;
+ base::HistogramTester histogram_tester_;
};
TEST_F(PasswordStoreMacTest, TestStoreUpdate) {
« no previous file with comments | « chrome/browser/password_manager/password_store_mac.cc ('k') | components/password_manager/core/browser/login_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698