| 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" |
| 11 #include "net/quic/crypto/channel_id.h" | 11 #include "net/quic/crypto/channel_id.h" |
| 12 #include "net/quic/crypto/channel_id_chromium.h" | 12 #include "net/quic/crypto/channel_id_chromium.h" |
| 13 | 13 |
| 14 using base::StringPiece; | 14 using base::StringPiece; |
| 15 using std::string; | 15 using std::string; |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 namespace test { | 19 namespace test { |
| 20 | 20 |
| 21 class TestChannelIDSource : public ChannelIDSource { | 21 class TestChannelIDSource : public ChannelIDSource { |
| 22 public: | 22 public: |
| 23 virtual ~TestChannelIDSource() { | 23 ~TestChannelIDSource() override { STLDeleteValues(&hostname_to_key_); } |
| 24 STLDeleteValues(&hostname_to_key_); | |
| 25 } | |
| 26 | 24 |
| 27 // ChannelIDSource implementation. | 25 // ChannelIDSource implementation. |
| 28 | 26 |
| 29 virtual QuicAsyncStatus GetChannelIDKey( | 27 QuicAsyncStatus GetChannelIDKey( |
| 30 const string& hostname, | 28 const string& hostname, |
| 31 scoped_ptr<ChannelIDKey>* channel_id_key, | 29 scoped_ptr<ChannelIDKey>* channel_id_key, |
| 32 ChannelIDSourceCallback* /*callback*/) override { | 30 ChannelIDSourceCallback* /*callback*/) override { |
| 33 channel_id_key->reset(new ChannelIDKeyChromium(HostnameToKey(hostname))); | 31 channel_id_key->reset(new ChannelIDKeyChromium(HostnameToKey(hostname))); |
| 34 return QUIC_SUCCESS; | 32 return QUIC_SUCCESS; |
| 35 } | 33 } |
| 36 | 34 |
| 37 private: | 35 private: |
| 38 typedef std::map<string, crypto::ECPrivateKey*> HostnameToKeyMap; | 36 typedef std::map<string, crypto::ECPrivateKey*> HostnameToKeyMap; |
| 39 | 37 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 55 }; | 53 }; |
| 56 | 54 |
| 57 // static | 55 // static |
| 58 ChannelIDSource* CryptoTestUtils::ChannelIDSourceForTesting() { | 56 ChannelIDSource* CryptoTestUtils::ChannelIDSourceForTesting() { |
| 59 return new TestChannelIDSource(); | 57 return new TestChannelIDSource(); |
| 60 } | 58 } |
| 61 | 59 |
| 62 } // namespace test | 60 } // namespace test |
| 63 | 61 |
| 64 } // namespace net | 62 } // namespace net |
| OLD | NEW |