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

Side by Side Diff: components/os_crypt/key_storage_libsecret_unittest.cc

Issue 2465083002: Add a dummy entry with libsecret when initializing OSCrypt. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "components/os_crypt/key_storage_libsecret.h" 9 #include "components/os_crypt/key_storage_libsecret.h"
10 #include "components/os_crypt/libsecret_util_linux.h" 10 #include "components/os_crypt/libsecret_util_linux.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 // static 95 // static
96 gboolean MockLibsecretLoader::mock_secret_password_store_sync( 96 gboolean MockLibsecretLoader::mock_secret_password_store_sync(
97 const SecretSchema* schema, 97 const SecretSchema* schema,
98 const gchar* collection, 98 const gchar* collection,
99 const gchar* label, 99 const gchar* label,
100 const gchar* password, 100 const gchar* password,
101 GCancellable* cancellable, 101 GCancellable* cancellable,
102 GError** error, 102 GError** error,
103 ...) { 103 ...) {
104 // TODO(crbug.com/660005) We don't read the dummy we store to unlock keyring.
105 if (strcmp("_chrome_dummy_schema_for_unlocking", schema->name) == 0)
106 return true;
107
104 EXPECT_STREQ(kKeystoreSchemaV2.name, schema->name); 108 EXPECT_STREQ(kKeystoreSchemaV2.name, schema->name);
105 delete stored_password_mock_ptr_; 109 delete stored_password_mock_ptr_;
106 stored_password_mock_ptr_ = new MockSecretValue(password); 110 stored_password_mock_ptr_ = new MockSecretValue(password);
107 return true; 111 return true;
108 } 112 }
109 113
110 // static 114 // static
111 void MockLibsecretLoader::mock_secret_value_unref(gpointer value) {} 115 void MockLibsecretLoader::mock_secret_value_unref(gpointer value) {}
112 116
113 // static 117 // static
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 236
233 TEST_F(LibsecretTest, LibsecretMigratesFromSchemaV1ToV2) { 237 TEST_F(LibsecretTest, LibsecretMigratesFromSchemaV1ToV2) {
234 KeyStorageLibsecret libsecret; 238 KeyStorageLibsecret libsecret;
235 MockLibsecretLoader::ResetForOSCrypt(); 239 MockLibsecretLoader::ResetForOSCrypt();
236 MockLibsecretLoader::SetDeprecatedOSCryptPassword("swallow"); 240 MockLibsecretLoader::SetDeprecatedOSCryptPassword("swallow");
237 std::string password = libsecret.GetKey(); 241 std::string password = libsecret.GetKey();
238 EXPECT_EQ("swallow", password); 242 EXPECT_EQ("swallow", password);
239 } 243 }
240 244
241 } // namespace 245 } // namespace
OLDNEW
« no previous file with comments | « components/os_crypt/key_storage_libsecret.cc ('k') | components/os_crypt/libsecret_util_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698