OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "net/ssl/openssl_client_key_store.h" | 5 #include "net/ssl/openssl_client_key_store.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "net/ssl/ssl_private_key.h" | 9 #include "net/ssl/ssl_private_key.h" |
10 #include "net/test/cert_test_util.h" | 10 #include "net/test/cert_test_util.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 protected: | 31 protected: |
32 OpenSSLClientKeyStore* store_; | 32 OpenSSLClientKeyStore* store_; |
33 }; | 33 }; |
34 | 34 |
35 class MockSSLPrivateKey : public SSLPrivateKey { | 35 class MockSSLPrivateKey : public SSLPrivateKey { |
36 public: | 36 public: |
37 MockSSLPrivateKey() : on_destroyed_(nullptr) {} | 37 MockSSLPrivateKey() : on_destroyed_(nullptr) {} |
38 | 38 |
39 void set_on_destroyed(bool* on_destroyed) { on_destroyed_ = on_destroyed; } | 39 void set_on_destroyed(bool* on_destroyed) { on_destroyed_ = on_destroyed; } |
40 | 40 |
41 Type GetType() override { | |
42 NOTREACHED(); | |
43 return Type::RSA; | |
44 } | |
45 | |
46 std::vector<Hash> GetDigestPreferences() override { | 41 std::vector<Hash> GetDigestPreferences() override { |
47 NOTREACHED(); | 42 NOTREACHED(); |
48 return {}; | 43 return {}; |
49 } | 44 } |
50 | 45 |
51 size_t GetMaxSignatureLengthInBytes() override { | |
52 NOTREACHED(); | |
53 return 0; | |
54 } | |
55 | |
56 void SignDigest(Hash hash, | 46 void SignDigest(Hash hash, |
57 const base::StringPiece& input, | 47 const base::StringPiece& input, |
58 const SignCallback& callback) override { | 48 const SignCallback& callback) override { |
59 NOTREACHED(); | 49 NOTREACHED(); |
60 } | 50 } |
61 | 51 |
62 private: | 52 private: |
63 ~MockSSLPrivateKey() override { | 53 ~MockSSLPrivateKey() override { |
64 if (on_destroyed_) | 54 if (on_destroyed_) |
65 *on_destroyed_ = true; | 55 *on_destroyed_ = true; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 152 |
163 EXPECT_TRUE(fetch_key1); | 153 EXPECT_TRUE(fetch_key1); |
164 EXPECT_TRUE(fetch_key2); | 154 EXPECT_TRUE(fetch_key2); |
165 | 155 |
166 EXPECT_EQ(fetch_key1.get(), priv_key1.get()); | 156 EXPECT_EQ(fetch_key1.get(), priv_key1.get()); |
167 EXPECT_EQ(fetch_key2.get(), priv_key2.get()); | 157 EXPECT_EQ(fetch_key2.get(), priv_key2.get()); |
168 } | 158 } |
169 | 159 |
170 } // namespace | 160 } // namespace |
171 } // namespace net | 161 } // namespace net |
OLD | NEW |