| OLD | NEW |
| 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/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/threading/thread_restrictions.h" | 12 #include "base/threading/thread_restrictions.h" |
| 13 #include "chromeos/chromeos_paths.h" | 13 #include "chromeos/chromeos_paths.h" |
| 14 #include "chromeos/dbus/cryptohome/key.pb.h" | 14 #include "chromeos/dbus/cryptohome/key.pb.h" |
| 15 #include "chromeos/dbus/cryptohome/rpc.pb.h" | 15 #include "chromeos/dbus/cryptohome/rpc.pb.h" |
| 16 #include "crypto/nss_util.h" | |
| 17 #include "third_party/cros_system_api/dbus/service_constants.h" | 16 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 18 #include "third_party/protobuf/src/google/protobuf/io/coded_stream.h" | 17 #include "third_party/protobuf/src/google/protobuf/io/coded_stream.h" |
| 19 #include "third_party/protobuf/src/google/protobuf/io/zero_copy_stream.h" | 18 #include "third_party/protobuf/src/google/protobuf/io/zero_copy_stream.h" |
| 20 #include "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite
.h" | 19 #include "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite
.h" |
| 21 | 20 |
| 22 namespace chromeos { | 21 namespace chromeos { |
| 23 | 22 |
| 24 FakeCryptohomeClient::FakeCryptohomeClient() | 23 FakeCryptohomeClient::FakeCryptohomeClient() |
| 25 : service_is_available_(true), | 24 : service_is_available_(true), |
| 26 async_call_id_(1), | 25 async_call_id_(1), |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 206 } |
| 208 | 207 |
| 209 void FakeCryptohomeClient::Pkcs11IsTpmTokenReady( | 208 void FakeCryptohomeClient::Pkcs11IsTpmTokenReady( |
| 210 const BoolDBusMethodCallback& callback) { | 209 const BoolDBusMethodCallback& callback) { |
| 211 base::MessageLoop::current()->PostTask( | 210 base::MessageLoop::current()->PostTask( |
| 212 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true)); | 211 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true)); |
| 213 } | 212 } |
| 214 | 213 |
| 215 void FakeCryptohomeClient::Pkcs11GetTpmTokenInfo( | 214 void FakeCryptohomeClient::Pkcs11GetTpmTokenInfo( |
| 216 const Pkcs11GetTpmTokenInfoCallback& callback) { | 215 const Pkcs11GetTpmTokenInfoCallback& callback) { |
| 216 const char kStubTPMTokenName[] = "StubTPMTokenName"; |
| 217 const char kStubUserPin[] = "012345"; | 217 const char kStubUserPin[] = "012345"; |
| 218 const int kStubSlot = 0; | 218 const int kStubSlot = 0; |
| 219 base::MessageLoop::current()->PostTask( | 219 base::MessageLoop::current()->PostTask( |
| 220 FROM_HERE, | 220 FROM_HERE, |
| 221 base::Bind(callback, | 221 base::Bind(callback, |
| 222 DBUS_METHOD_CALL_SUCCESS, | 222 DBUS_METHOD_CALL_SUCCESS, |
| 223 std::string(crypto::kTestTPMTokenName), | 223 std::string(kStubTPMTokenName), |
| 224 std::string(kStubUserPin), | 224 std::string(kStubUserPin), |
| 225 kStubSlot)); | 225 kStubSlot)); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void FakeCryptohomeClient::Pkcs11GetTpmTokenInfoForUser( | 228 void FakeCryptohomeClient::Pkcs11GetTpmTokenInfoForUser( |
| 229 const std::string& username, | 229 const std::string& username, |
| 230 const Pkcs11GetTpmTokenInfoCallback& callback) { | 230 const Pkcs11GetTpmTokenInfoCallback& callback) { |
| 231 Pkcs11GetTpmTokenInfo(callback); | 231 Pkcs11GetTpmTokenInfo(callback); |
| 232 } | 232 } |
| 233 | 233 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 FROM_HERE, | 587 FROM_HERE, |
| 588 base::Bind(async_call_status_data_handler_, | 588 base::Bind(async_call_status_data_handler_, |
| 589 async_call_id_, | 589 async_call_id_, |
| 590 true, | 590 true, |
| 591 std::string())); | 591 std::string())); |
| 592 } | 592 } |
| 593 ++async_call_id_; | 593 ++async_call_id_; |
| 594 } | 594 } |
| 595 | 595 |
| 596 } // namespace chromeos | 596 } // namespace chromeos |
| OLD | NEW |