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

Side by Side Diff: chromeos/dbus/fake_cryptohome_client.cc

Issue 26407002: Add support for the Pkcs11GetTpmTokenInfoForUser cryptohome call. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chromeos/dbus/fake_cryptohome_client.h" 5 #include "chromeos/dbus/fake_cryptohome_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "crypto/nss_util.h" 10 #include "crypto/nss_util.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 184
185 void FakeCryptohomeClient::Pkcs11IsTpmTokenReady( 185 void FakeCryptohomeClient::Pkcs11IsTpmTokenReady(
186 const BoolDBusMethodCallback& callback) { 186 const BoolDBusMethodCallback& callback) {
187 base::MessageLoop::current()->PostTask( 187 base::MessageLoop::current()->PostTask(
188 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true)); 188 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
189 } 189 }
190 190
191 void FakeCryptohomeClient::Pkcs11GetTpmTokenInfo( 191 void FakeCryptohomeClient::Pkcs11GetTpmTokenInfo(
192 const Pkcs11GetTpmTokenInfoCallback& callback) { 192 const Pkcs11GetTpmTokenInfoCallback& callback) {
193 const char kStubUserPin[] = "012345"; 193 const char kStubUserPin[] = "012345";
194 const int kStubSlot = 0;
194 base::MessageLoop::current()->PostTask( 195 base::MessageLoop::current()->PostTask(
195 FROM_HERE, 196 FROM_HERE,
196 base::Bind(callback, 197 base::Bind(callback,
197 DBUS_METHOD_CALL_SUCCESS, 198 DBUS_METHOD_CALL_SUCCESS,
198 std::string(crypto::kTestTPMTokenName), 199 std::string(crypto::kTestTPMTokenName),
199 std::string(kStubUserPin))); 200 std::string(kStubUserPin),
201 kStubSlot));
202 }
203
204 void FakeCryptohomeClient::Pkcs11GetTpmTokenInfoForUser(
205 const std::string& username,
206 const Pkcs11GetTpmTokenInfoCallback& callback) {
207 Pkcs11GetTpmTokenInfo(callback);
200 } 208 }
201 209
202 bool FakeCryptohomeClient::InstallAttributesGet(const std::string& name, 210 bool FakeCryptohomeClient::InstallAttributesGet(const std::string& name,
203 std::vector<uint8>* value, 211 std::vector<uint8>* value,
204 bool* successful) { 212 bool* successful) {
205 if (install_attrs_.find(name) != install_attrs_.end()) { 213 if (install_attrs_.find(name) != install_attrs_.end()) {
206 *value = install_attrs_[name]; 214 *value = install_attrs_[name];
207 *successful = true; 215 *successful = true;
208 } else { 216 } else {
209 value->clear(); 217 value->clear();
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 FROM_HERE, 388 FROM_HERE,
381 base::Bind(async_call_status_data_handler_, 389 base::Bind(async_call_status_data_handler_,
382 async_call_id_, 390 async_call_id_,
383 true, 391 true,
384 std::string())); 392 std::string()));
385 } 393 }
386 ++async_call_id_; 394 ++async_call_id_;
387 } 395 }
388 396
389 } // namespace chromeos 397 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698