OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h" | 5 #include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
38 #include "chromeos/dbus/fake_cryptohome_client.h" | 38 #include "chromeos/dbus/fake_cryptohome_client.h" |
39 #include "chromeos/login/auth/key.h" | 39 #include "chromeos/login/auth/key.h" |
40 #include "chromeos/login/auth/mock_auth_status_consumer.h" | 40 #include "chromeos/login/auth/mock_auth_status_consumer.h" |
41 #include "chromeos/login/auth/mock_url_fetchers.h" | 41 #include "chromeos/login/auth/mock_url_fetchers.h" |
42 #include "chromeos/login/auth/test_attempt_state.h" | 42 #include "chromeos/login/auth/test_attempt_state.h" |
43 #include "chromeos/login/auth/user_context.h" | 43 #include "chromeos/login/auth/user_context.h" |
44 #include "chromeos/login/login_state.h" | 44 #include "chromeos/login/login_state.h" |
45 #include "components/ownership/mock_owner_key_util.h" | 45 #include "components/ownership/mock_owner_key_util.h" |
46 #include "components/user_manager/fake_user_manager.h" | 46 #include "components/user_manager/fake_user_manager.h" |
47 #include "content/public/test/test_browser_thread_bundle.h" | 47 #include "content/public/test/test_browser_thread_bundle.h" |
48 #include "crypto/nss_key_util.h" | |
48 #include "crypto/nss_util_internal.h" | 49 #include "crypto/nss_util_internal.h" |
49 #include "crypto/scoped_test_nss_chromeos_user.h" | 50 #include "crypto/scoped_test_nss_chromeos_user.h" |
50 #include "google_apis/gaia/mock_url_fetcher_factory.h" | 51 #include "google_apis/gaia/mock_url_fetcher_factory.h" |
51 #include "net/base/net_errors.h" | 52 #include "net/base/net_errors.h" |
52 #include "net/url_request/url_request_status.h" | 53 #include "net/url_request/url_request_status.h" |
53 #include "testing/gmock/include/gmock/gmock.h" | 54 #include "testing/gmock/include/gmock/gmock.h" |
54 #include "testing/gtest/include/gtest/gtest.h" | 55 #include "testing/gtest/include/gtest/gtest.h" |
55 #include "third_party/cros_system_api/dbus/service_constants.h" | 56 #include "third_party/cros_system_api/dbus/service_constants.h" |
56 #include "url/gurl.h" | 57 #include "url/gurl.h" |
57 | 58 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 0xf3, 0xec, 0xab, 0x41, 0x57, 0x1d, 0x5f, 0xed, 0xcf, 0x09, 0xf4, 0xcc, | 112 0xf3, 0xec, 0xab, 0x41, 0x57, 0x1d, 0x5f, 0xed, 0xcf, 0x09, 0xf4, 0xcc, |
112 0xbb, 0x52, 0x52, 0xe8, 0x46, 0xf5, 0xc5, 0x01, 0xa3, 0xd8, 0x24, 0xc0, | 113 0xbb, 0x52, 0x52, 0xe8, 0x46, 0xf5, 0xc5, 0x01, 0xa3, 0xd8, 0x24, 0xc0, |
113 0x15, 0xc5, 0x65, 0x50, 0x7d, 0xbd, 0x4e, 0x81, 0xb2, 0x28, 0x38, 0xf9, | 114 0x15, 0xc5, 0x65, 0x50, 0x7d, 0xbd, 0x4e, 0x81, 0xb2, 0x28, 0x38, 0xf9, |
114 0x3d, 0x3e, 0x2a, 0x68, 0xf7, 0x02, 0x03, 0x01, 0x00, 0x01}; | 115 0x3d, 0x3e, 0x2a, 0x68, 0xf7, 0x02, 0x03, 0x01, 0x00, 0x01}; |
115 | 116 |
116 std::vector<uint8> GetOwnerPublicKey() { | 117 std::vector<uint8> GetOwnerPublicKey() { |
117 return std::vector<uint8>(kOwnerPublicKey, | 118 return std::vector<uint8>(kOwnerPublicKey, |
118 kOwnerPublicKey + arraysize(kOwnerPublicKey)); | 119 kOwnerPublicKey + arraysize(kOwnerPublicKey)); |
119 } | 120 } |
120 | 121 |
121 scoped_ptr<crypto::RSAPrivateKey> CreateOwnerKeyInSlot(PK11SlotInfo* slot) { | 122 crypto::ScopedSECKEYPrivateKey CreateOwnerKeyInSlot(PK11SlotInfo* slot) { |
pneubeck (no reviews)
2015/04/28 09:56:26
just drop the return type, it's anyways not used.
davidben
2015/04/28 16:27:45
Switched it to a bool + ASSERT_TRUE.
| |
122 const std::vector<uint8> key(kOwnerPrivateKey, | 123 const std::vector<uint8> key(kOwnerPrivateKey, |
123 kOwnerPrivateKey + arraysize(kOwnerPrivateKey)); | 124 kOwnerPrivateKey + arraysize(kOwnerPrivateKey)); |
124 return make_scoped_ptr( | 125 return crypto::ImportNSSKeyFromPrivateKeyInfo(slot, key, |
125 crypto::RSAPrivateKey::CreateSensitiveFromPrivateKeyInfo(slot, key)); | 126 true /* permanent */); |
126 } | 127 } |
127 | 128 |
128 } // namespace | 129 } // namespace |
129 | 130 |
130 class CryptohomeAuthenticatorTest : public testing::Test { | 131 class CryptohomeAuthenticatorTest : public testing::Test { |
131 public: | 132 public: |
132 CryptohomeAuthenticatorTest() | 133 CryptohomeAuthenticatorTest() |
133 : user_context_("me@nowhere.org"), | 134 : user_context_("me@nowhere.org"), |
134 user_manager_(new user_manager::FakeUserManager()), | 135 user_manager_(new user_manager::FakeUserManager()), |
135 user_manager_enabler_(user_manager_), | 136 user_manager_enabler_(user_manager_), |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
772 // salt. | 773 // salt. |
773 ExpectGetKeyDataExCall( | 774 ExpectGetKeyDataExCall( |
774 make_scoped_ptr(new int64(Key::KEY_TYPE_SALTED_SHA256)), | 775 make_scoped_ptr(new int64(Key::KEY_TYPE_SALTED_SHA256)), |
775 scoped_ptr<std::string>()); | 776 scoped_ptr<std::string>()); |
776 | 777 |
777 auth_->AuthenticateToLogin(NULL, user_context_); | 778 auth_->AuthenticateToLogin(NULL, user_context_); |
778 base::RunLoop().Run(); | 779 base::RunLoop().Run(); |
779 } | 780 } |
780 | 781 |
781 } // namespace chromeos | 782 } // namespace chromeos |
OLD | NEW |