OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/strings/string_util.h" | |
7 #include "net/quic/crypto/channel_id.h" | 8 #include "net/quic/crypto/channel_id.h" |
8 #include "net/quic/crypto/common_cert_set.h" | 9 #include "net/quic/crypto/common_cert_set.h" |
9 #include "net/quic/crypto/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
10 #include "net/quic/crypto/quic_crypto_server_config.h" | 11 #include "net/quic/crypto/quic_crypto_server_config.h" |
11 #include "net/quic/crypto/quic_decrypter.h" | 12 #include "net/quic/crypto/quic_decrypter.h" |
12 #include "net/quic/crypto/quic_encrypter.h" | 13 #include "net/quic/crypto/quic_encrypter.h" |
13 #include "net/quic/crypto/quic_random.h" | 14 #include "net/quic/crypto/quic_random.h" |
14 #include "net/quic/quic_clock.h" | 15 #include "net/quic/quic_clock.h" |
15 #include "net/quic/quic_crypto_client_stream.h" | 16 #include "net/quic/quic_crypto_client_stream.h" |
16 #include "net/quic/quic_crypto_server_stream.h" | 17 #include "net/quic/quic_crypto_server_stream.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 | 49 |
49 const vector<CryptoHandshakeMessage>& messages() const { return messages_; } | 50 const vector<CryptoHandshakeMessage>& messages() const { return messages_; } |
50 | 51 |
51 private: | 52 private: |
52 bool error_; | 53 bool error_; |
53 vector<CryptoHandshakeMessage> messages_; | 54 vector<CryptoHandshakeMessage> messages_; |
54 }; | 55 }; |
55 | 56 |
56 // HexChar parses |c| as a hex character. If valid, it sets |*value| to the | 57 // HexChar parses |c| as a hex character. If valid, it sets |*value| to the |
57 // value of the hex character and returns true. Otherwise it returns false. | 58 // value of the hex character and returns true. Otherwise it returns false. |
58 bool HexChar(char c, uint8_t* value) { | 59 bool HexChar(char c, uint8_t* value) { |
brettw
2016/04/12 21:41:07
Optional: this whole function can be replaced with
Zhongyi Shi
2016/04/12 21:57:41
Thanks for catching this, this lives in the QUIC s
| |
59 if (c >= '0' && c <= '9') { | 60 if (base::IsAsciiDigit(c)) { |
60 *value = c - '0'; | 61 *value = c - '0'; |
61 return true; | 62 return true; |
62 } | 63 } |
63 if (c >= 'a' && c <= 'f') { | 64 if (c >= 'a' && c <= 'f') { |
64 *value = c - 'a' + 10; | 65 *value = c - 'a' + 10; |
65 return true; | 66 return true; |
66 } | 67 } |
67 if (c >= 'A' && c <= 'F') { | 68 if (c >= 'A' && c <= 'F') { |
68 *value = c - 'A' + 10; | 69 *value = c - 'A' + 10; |
69 return true; | 70 return true; |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
641 | 642 |
642 ASSERT_EQ(0u, crypto_framer.InputBytesRemaining()); | 643 ASSERT_EQ(0u, crypto_framer.InputBytesRemaining()); |
643 | 644 |
644 for (const CryptoHandshakeMessage& message : crypto_visitor.messages()) { | 645 for (const CryptoHandshakeMessage& message : crypto_visitor.messages()) { |
645 dest_stream->OnHandshakeMessage(message); | 646 dest_stream->OnHandshakeMessage(message); |
646 } | 647 } |
647 } | 648 } |
648 | 649 |
649 } // namespace test | 650 } // namespace test |
650 } // namespace net | 651 } // namespace net |
OLD | NEW |