| 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 "net/quic/test_tools/crypto_test_utils.h" | 5 #include "net/quic/test_tools/crypto_test_utils.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "crypto/ec_private_key.h" | 9 #include "crypto/ec_private_key.h" |
| 10 #include "crypto/ec_signature_creator.h" | 10 #include "crypto/ec_signature_creator.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 public: | 22 public: |
| 23 virtual ~TestChannelIDSource() { | 23 virtual ~TestChannelIDSource() { |
| 24 STLDeleteValues(&hostname_to_key_); | 24 STLDeleteValues(&hostname_to_key_); |
| 25 } | 25 } |
| 26 | 26 |
| 27 // ChannelIDSource implementation. | 27 // ChannelIDSource implementation. |
| 28 | 28 |
| 29 virtual QuicAsyncStatus GetChannelIDKey( | 29 virtual QuicAsyncStatus GetChannelIDKey( |
| 30 const string& hostname, | 30 const string& hostname, |
| 31 scoped_ptr<ChannelIDKey>* channel_id_key, | 31 scoped_ptr<ChannelIDKey>* channel_id_key, |
| 32 ChannelIDSourceCallback* /*callback*/) OVERRIDE { | 32 ChannelIDSourceCallback* /*callback*/) override { |
| 33 channel_id_key->reset(new ChannelIDKeyChromium(HostnameToKey(hostname))); | 33 channel_id_key->reset(new ChannelIDKeyChromium(HostnameToKey(hostname))); |
| 34 return QUIC_SUCCESS; | 34 return QUIC_SUCCESS; |
| 35 } | 35 } |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 typedef std::map<string, crypto::ECPrivateKey*> HostnameToKeyMap; | 38 typedef std::map<string, crypto::ECPrivateKey*> HostnameToKeyMap; |
| 39 | 39 |
| 40 crypto::ECPrivateKey* HostnameToKey(const string& hostname) { | 40 crypto::ECPrivateKey* HostnameToKey(const string& hostname) { |
| 41 HostnameToKeyMap::const_iterator it = hostname_to_key_.find(hostname); | 41 HostnameToKeyMap::const_iterator it = hostname_to_key_.find(hostname); |
| 42 if (it != hostname_to_key_.end()) { | 42 if (it != hostname_to_key_.end()) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 // static | 57 // static |
| 58 ChannelIDSource* CryptoTestUtils::ChannelIDSourceForTesting() { | 58 ChannelIDSource* CryptoTestUtils::ChannelIDSourceForTesting() { |
| 59 return new TestChannelIDSource(); | 59 return new TestChannelIDSource(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace test | 62 } // namespace test |
| 63 | 63 |
| 64 } // namespace net | 64 } // namespace net |
| OLD | NEW |