OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/tools/quic/chlo_extractor.h" | 5 #include "net/tools/quic/chlo_extractor.h" |
6 | 6 |
7 #include "net/quic/core/quic_framer.h" | 7 #include "net/quic/core/quic_framer.h" |
8 #include "net/quic/test_tools/crypto_test_utils.h" | 8 #include "net/quic/test_tools/crypto_test_utils.h" |
9 #include "net/quic/test_tools/quic_test_utils.h" | 9 #include "net/quic/test_tools/quic_test_utils.h" |
10 | 10 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 .as_string()); | 87 .as_string()); |
88 // Construct a CHLO with each supported version | 88 // Construct a CHLO with each supported version |
89 for (QuicVersion version : AllSupportedVersions()) { | 89 for (QuicVersion version : AllSupportedVersions()) { |
90 QuicVersionVector versions(SupportedVersions(version)); | 90 QuicVersionVector versions(SupportedVersions(version)); |
91 header_.public_header.versions = versions; | 91 header_.public_header.versions = versions; |
92 MakePacket( | 92 MakePacket( |
93 new QuicStreamFrame(kCryptoStreamId, false, 0, client_hello_str)); | 93 new QuicStreamFrame(kCryptoStreamId, false, 0, client_hello_str)); |
94 EXPECT_TRUE(ChloExtractor::Extract(*packet_, versions, &delegate_)) | 94 EXPECT_TRUE(ChloExtractor::Extract(*packet_, versions, &delegate_)) |
95 << QuicVersionToString(version); | 95 << QuicVersionToString(version); |
96 EXPECT_EQ(version, delegate_.version()); | 96 EXPECT_EQ(version, delegate_.version()); |
97 EXPECT_EQ(header_.public_header.connection_id, delegate_.connection_id()); | 97 EXPECT_EQ(GetPeerInMemoryConnectionId(header_.public_header.connection_id), |
| 98 delegate_.connection_id()); |
98 EXPECT_EQ(client_hello.DebugString(Perspective::IS_SERVER), | 99 EXPECT_EQ(client_hello.DebugString(Perspective::IS_SERVER), |
99 delegate_.chlo()) | 100 delegate_.chlo()) |
100 << QuicVersionToString(version); | 101 << QuicVersionToString(version); |
101 } | 102 } |
102 } | 103 } |
103 | 104 |
104 TEST_F(ChloExtractorTest, DoesNotFindValidChloOnWrongStream) { | 105 TEST_F(ChloExtractorTest, DoesNotFindValidChloOnWrongStream) { |
105 CryptoHandshakeMessage client_hello; | 106 CryptoHandshakeMessage client_hello; |
106 client_hello.set_tag(kCHLO); | 107 client_hello.set_tag(kCHLO); |
107 | 108 |
(...skipping 20 matching lines...) Expand all Loading... |
128 | 129 |
129 TEST_F(ChloExtractorTest, DoesNotFindInvalidChlo) { | 130 TEST_F(ChloExtractorTest, DoesNotFindInvalidChlo) { |
130 MakePacket(new QuicStreamFrame(kCryptoStreamId, false, 0, "foo")); | 131 MakePacket(new QuicStreamFrame(kCryptoStreamId, false, 0, "foo")); |
131 EXPECT_FALSE( | 132 EXPECT_FALSE( |
132 ChloExtractor::Extract(*packet_, AllSupportedVersions(), &delegate_)); | 133 ChloExtractor::Extract(*packet_, AllSupportedVersions(), &delegate_)); |
133 } | 134 } |
134 | 135 |
135 } // namespace | 136 } // namespace |
136 } // namespace test | 137 } // namespace test |
137 } // namespace net | 138 } // namespace net |
OLD | NEW |