OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/crypto/crypto_handshake_message.h" | 5 #include "net/quic/crypto/crypto_handshake_message.h" |
6 | 6 |
7 #include "net/quic/crypto/crypto_handshake.h" | 7 #include "net/quic/crypto/crypto_handshake.h" |
8 #include "net/quic/crypto/crypto_protocol.h" | 8 #include "net/quic/crypto/crypto_protocol.h" |
9 #include "net/test/gtest_util.h" | 9 #include "net/test/gtest_util.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 namespace test { | 12 namespace test { |
13 namespace { | 13 namespace { |
14 | 14 |
15 TEST(CryptoHandshakeMessageTest, DebugString) { | 15 TEST(CryptoHandshakeMessageTest, DebugString) { |
16 CryptoHandshakeMessage message; | 16 CryptoHandshakeMessage message; |
17 message.set_tag(kSHLO); | 17 message.set_tag(kSHLO); |
18 EXPECT_EQ("SHLO<\n>", message.DebugString()); | 18 EXPECT_EQ("SHLO<\n>", message.DebugString()); |
19 } | 19 } |
20 | 20 |
21 TEST(CryptoHandshakeMessageTest, DebugStringWithUintVector) { | 21 TEST(CryptoHandshakeMessageTest, DebugStringWithUintVector) { |
22 CryptoHandshakeMessage message; | 22 CryptoHandshakeMessage message; |
23 message.set_tag(kREJ); | 23 message.set_tag(kREJ); |
24 std::vector<uint32> reasons = { | 24 std::vector<uint32_t> reasons = { |
25 SOURCE_ADDRESS_TOKEN_DIFFERENT_IP_ADDRESS_FAILURE, | 25 SOURCE_ADDRESS_TOKEN_DIFFERENT_IP_ADDRESS_FAILURE, |
26 CLIENT_NONCE_NOT_UNIQUE_FAILURE}; | 26 CLIENT_NONCE_NOT_UNIQUE_FAILURE}; |
27 message.SetVector(kRREJ, reasons); | 27 message.SetVector(kRREJ, reasons); |
28 EXPECT_EQ( | 28 EXPECT_EQ( |
29 "REJ <\n RREJ: " | 29 "REJ <\n RREJ: " |
30 "SOURCE_ADDRESS_TOKEN_DIFFERENT_IP_ADDRESS_FAILURE," | 30 "SOURCE_ADDRESS_TOKEN_DIFFERENT_IP_ADDRESS_FAILURE," |
31 "CLIENT_NONCE_NOT_UNIQUE_FAILURE\n>", | 31 "CLIENT_NONCE_NOT_UNIQUE_FAILURE\n>", |
32 message.DebugString()); | 32 message.DebugString()); |
33 } | 33 } |
34 | 34 |
35 TEST(CryptoHandshakeMessageTest, DebugStringWithTagVector) { | 35 TEST(CryptoHandshakeMessageTest, DebugStringWithTagVector) { |
36 CryptoHandshakeMessage message; | 36 CryptoHandshakeMessage message; |
37 message.set_tag(kCHLO); | 37 message.set_tag(kCHLO); |
38 message.SetTaglist(kCOPT, kTBBR, kPAD, kBYTE, 0); | 38 message.SetTaglist(kCOPT, kTBBR, kPAD, kBYTE, 0); |
39 EXPECT_EQ("CHLO<\n COPT: 'TBBR','PAD ','BYTE'\n>", message.DebugString()); | 39 EXPECT_EQ("CHLO<\n COPT: 'TBBR','PAD ','BYTE'\n>", message.DebugString()); |
40 } | 40 } |
41 | 41 |
42 } // namespace | 42 } // namespace |
43 } // namespace test | 43 } // namespace test |
44 } // namespace net | 44 } // namespace net |
OLD | NEW |