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/quic/core/quic_utils.h" | 5 #include "net/quic/core/quic_utils.h" |
6 | 6 |
7 #include "net/quic/core/crypto/crypto_protocol.h" | 7 #include "net/quic/core/crypto/crypto_protocol.h" |
8 #include "net/quic/core/quic_flags.h" | 8 #include "net/quic/core/quic_flags.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 EXPECT_EQ("SCFG", QuicUtils::TagToString(kSCFG)); | 28 EXPECT_EQ("SCFG", QuicUtils::TagToString(kSCFG)); |
29 EXPECT_EQ("SNO ", QuicUtils::TagToString(kServerNonceTag)); | 29 EXPECT_EQ("SNO ", QuicUtils::TagToString(kServerNonceTag)); |
30 EXPECT_EQ("CRT ", QuicUtils::TagToString(kCertificateTag)); | 30 EXPECT_EQ("CRT ", QuicUtils::TagToString(kCertificateTag)); |
31 EXPECT_EQ("CHLO", QuicUtils::TagToString(MakeQuicTag('C', 'H', 'L', 'O'))); | 31 EXPECT_EQ("CHLO", QuicUtils::TagToString(MakeQuicTag('C', 'H', 'L', 'O'))); |
32 // A tag that contains a non-printing character will be printed as a decimal | 32 // A tag that contains a non-printing character will be printed as a decimal |
33 // number. | 33 // number. |
34 EXPECT_EQ("525092931", | 34 EXPECT_EQ("525092931", |
35 QuicUtils::TagToString(MakeQuicTag('C', 'H', 'L', '\x1f'))); | 35 QuicUtils::TagToString(MakeQuicTag('C', 'H', 'L', '\x1f'))); |
36 } | 36 } |
37 | 37 |
38 TEST(QuicUtilsTest, ListTags) { | |
39 QuicTagValueMap map; | |
40 map.insert(std::make_pair(kSCFG, "asd")); | |
41 map.insert(std::make_pair(kCHLO, "dsa")); | |
42 EXPECT_EQ("SCFG CHLO ", QuicUtils::ListTags(map)); | |
43 } | |
44 | |
45 TEST(QuicUtilsTest, ParseQuicConnectionOptions) { | 38 TEST(QuicUtilsTest, ParseQuicConnectionOptions) { |
46 QuicTagVector empty_options = QuicUtils::ParseQuicConnectionOptions(""); | 39 QuicTagVector empty_options = QuicUtils::ParseQuicConnectionOptions(""); |
47 EXPECT_EQ(0ul, empty_options.size()); | 40 EXPECT_EQ(0ul, empty_options.size()); |
48 | 41 |
49 QuicTagVector parsed_options = | 42 QuicTagVector parsed_options = |
50 QuicUtils::ParseQuicConnectionOptions("TIMER,TBBR,REJ"); | 43 QuicUtils::ParseQuicConnectionOptions("TIMER,TBBR,REJ"); |
51 QuicTagVector expected_options; | 44 QuicTagVector expected_options; |
52 expected_options.push_back(kTIME); | 45 expected_options.push_back(kTIME); |
53 expected_options.push_back(kTBBR); | 46 expected_options.push_back(kTBBR); |
54 expected_options.push_back(kREJ); | 47 expected_options.push_back(kREJ); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 "0x0010: 7320 7374 7269 6e67 2073 686f 756c 6420 s.string.should.\n" | 150 "0x0010: 7320 7374 7269 6e67 2073 686f 756c 6420 s.string.should.\n" |
158 "0x0020: 6265 206c 6f6e 6720 656e 6f75 6768 2074 be.long.enough.t\n" | 151 "0x0020: 6265 206c 6f6e 6720 656e 6f75 6768 2074 be.long.enough.t\n" |
159 "0x0030: 6f20 7370 616e 206d 756c 7469 706c 6520 o.span.multiple.\n" | 152 "0x0030: 6f20 7370 616e 206d 756c 7469 706c 6520 o.span.multiple.\n" |
160 "0x0040: 6c69 6e65 7320 6f66 206f 7574 7075 742e lines.of.output.\n" | 153 "0x0040: 6c69 6e65 7320 6f66 206f 7574 7075 742e lines.of.output.\n" |
161 "0x0050: 0102 03 ...\n"); | 154 "0x0050: 0102 03 ...\n"); |
162 } | 155 } |
163 | 156 |
164 } // namespace | 157 } // namespace |
165 } // namespace test | 158 } // namespace test |
166 } // namespace net | 159 } // namespace net |
OLD | NEW |