Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: net/quic/quic_config_test.cc

Issue 312553003: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_config.cc ('k') | net/quic/quic_connection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/quic_config.h" 5 #include "net/quic/quic_config.h"
6 6
7 #include "net/quic/crypto/crypto_handshake_message.h" 7 #include "net/quic/crypto/crypto_handshake_message.h"
8 #include "net/quic/crypto/crypto_protocol.h" 8 #include "net/quic/crypto/crypto_protocol.h"
9 #include "net/quic/quic_flags.h" 9 #include "net/quic/quic_flags.h"
10 #include "net/quic/quic_protocol.h" 10 #include "net/quic/quic_protocol.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 config_.ToHandshakeMessage(&msg); 62 config_.ToHandshakeMessage(&msg);
63 63
64 const QuicTag* out; 64 const QuicTag* out;
65 size_t out_len; 65 size_t out_len;
66 EXPECT_EQ(QUIC_NO_ERROR, msg.GetTaglist(kCGST, &out, &out_len)); 66 EXPECT_EQ(QUIC_NO_ERROR, msg.GetTaglist(kCGST, &out, &out_len));
67 EXPECT_EQ(2u, out_len); 67 EXPECT_EQ(2u, out_len);
68 EXPECT_EQ(kPACE, out[0]); 68 EXPECT_EQ(kPACE, out[0]);
69 EXPECT_EQ(kQBIC, out[1]); 69 EXPECT_EQ(kQBIC, out[1]);
70 } 70 }
71 71
72 TEST_F(QuicConfigTest, ProcessPeerHello) { 72 TEST_F(QuicConfigTest, ProcessClientHello) {
73 QuicConfig client_config; 73 QuicConfig client_config;
74 QuicTagVector cgst; 74 QuicTagVector cgst;
75 cgst.push_back(kINAR); 75 cgst.push_back(kINAR);
76 cgst.push_back(kQBIC); 76 cgst.push_back(kQBIC);
77 client_config.set_congestion_control(cgst, kQBIC); 77 client_config.set_congestion_feedback(cgst, kQBIC);
78 client_config.set_idle_connection_state_lifetime( 78 client_config.set_idle_connection_state_lifetime(
79 QuicTime::Delta::FromSeconds(2 * kDefaultTimeoutSecs), 79 QuicTime::Delta::FromSeconds(2 * kDefaultTimeoutSecs),
80 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs)); 80 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs));
81 client_config.set_max_streams_per_connection( 81 client_config.set_max_streams_per_connection(
82 2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection); 82 2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection);
83 client_config.SetInitialRoundTripTimeUsToSend( 83 client_config.SetInitialRoundTripTimeUsToSend(
84 10 * base::Time::kMicrosecondsPerMillisecond); 84 10 * base::Time::kMicrosecondsPerMillisecond);
85 QuicTagVector copt;
86 copt.push_back(kTBBR);
87 client_config.SetCongestionOptionsToSend(copt);
85 CryptoHandshakeMessage msg; 88 CryptoHandshakeMessage msg;
86 client_config.ToHandshakeMessage(&msg); 89 client_config.ToHandshakeMessage(&msg);
87 string error_details; 90 string error_details;
88 const QuicErrorCode error = 91 const QuicErrorCode error =
89 config_.ProcessPeerHello(msg, CLIENT, &error_details); 92 config_.ProcessPeerHello(msg, CLIENT, &error_details);
90 EXPECT_EQ(QUIC_NO_ERROR, error); 93 EXPECT_EQ(QUIC_NO_ERROR, error);
91 EXPECT_TRUE(config_.negotiated()); 94 EXPECT_TRUE(config_.negotiated());
92 EXPECT_EQ(kQBIC, config_.congestion_control()); 95 EXPECT_EQ(kQBIC, config_.congestion_feedback());
93 EXPECT_EQ(QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs), 96 EXPECT_EQ(QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs),
94 config_.idle_connection_state_lifetime()); 97 config_.idle_connection_state_lifetime());
95 EXPECT_EQ(kDefaultMaxStreamsPerConnection, 98 EXPECT_EQ(kDefaultMaxStreamsPerConnection,
96 config_.max_streams_per_connection()); 99 config_.max_streams_per_connection());
97 EXPECT_EQ(QuicTime::Delta::FromSeconds(0), config_.keepalive_timeout()); 100 EXPECT_EQ(QuicTime::Delta::FromSeconds(0), config_.keepalive_timeout());
98 EXPECT_EQ(10 * base::Time::kMicrosecondsPerMillisecond, 101 EXPECT_EQ(10 * base::Time::kMicrosecondsPerMillisecond,
99 config_.ReceivedInitialRoundTripTimeUs()); 102 config_.ReceivedInitialRoundTripTimeUs());
100 EXPECT_FALSE(config_.HasReceivedLossDetection()); 103 EXPECT_FALSE(config_.HasReceivedLossDetection());
104 EXPECT_TRUE(config_.HasReceivedCongestionOptions());
105 EXPECT_EQ(1u, config_.ReceivedCongestionOptions().size());
106 EXPECT_EQ(config_.ReceivedCongestionOptions()[0], kTBBR);
101 } 107 }
102 108
103 TEST_F(QuicConfigTest, ProcessServerHello) { 109 TEST_F(QuicConfigTest, ProcessServerHello) {
104 QuicConfig server_config; 110 QuicConfig server_config;
105 QuicTagVector cgst; 111 QuicTagVector cgst;
106 cgst.push_back(kQBIC); 112 cgst.push_back(kQBIC);
107 server_config.set_congestion_control(cgst, kQBIC); 113 server_config.set_congestion_feedback(cgst, kQBIC);
108 server_config.set_idle_connection_state_lifetime( 114 server_config.set_idle_connection_state_lifetime(
109 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs / 2), 115 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs / 2),
110 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs / 2)); 116 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs / 2));
111 server_config.set_max_streams_per_connection( 117 server_config.set_max_streams_per_connection(
112 kDefaultMaxStreamsPerConnection / 2, 118 kDefaultMaxStreamsPerConnection / 2,
113 kDefaultMaxStreamsPerConnection / 2); 119 kDefaultMaxStreamsPerConnection / 2);
114 server_config.SetInitialCongestionWindowToSend(kDefaultInitialWindow / 2); 120 server_config.SetInitialCongestionWindowToSend(kDefaultInitialWindow / 2);
115 server_config.SetInitialRoundTripTimeUsToSend( 121 server_config.SetInitialRoundTripTimeUsToSend(
116 10 * base::Time::kMicrosecondsPerMillisecond); 122 10 * base::Time::kMicrosecondsPerMillisecond);
117 CryptoHandshakeMessage msg; 123 CryptoHandshakeMessage msg;
118 server_config.ToHandshakeMessage(&msg); 124 server_config.ToHandshakeMessage(&msg);
119 string error_details; 125 string error_details;
120 const QuicErrorCode error = 126 const QuicErrorCode error =
121 config_.ProcessPeerHello(msg, SERVER, &error_details); 127 config_.ProcessPeerHello(msg, SERVER, &error_details);
122 EXPECT_EQ(QUIC_NO_ERROR, error); 128 EXPECT_EQ(QUIC_NO_ERROR, error);
123 EXPECT_TRUE(config_.negotiated()); 129 EXPECT_TRUE(config_.negotiated());
124 EXPECT_EQ(kQBIC, config_.congestion_control()); 130 EXPECT_EQ(kQBIC, config_.congestion_feedback());
125 EXPECT_EQ(QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs / 2), 131 EXPECT_EQ(QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs / 2),
126 config_.idle_connection_state_lifetime()); 132 config_.idle_connection_state_lifetime());
127 EXPECT_EQ(kDefaultMaxStreamsPerConnection / 2, 133 EXPECT_EQ(kDefaultMaxStreamsPerConnection / 2,
128 config_.max_streams_per_connection()); 134 config_.max_streams_per_connection());
129 EXPECT_EQ(kDefaultInitialWindow / 2, 135 EXPECT_EQ(kDefaultInitialWindow / 2,
130 config_.ReceivedInitialCongestionWindow()); 136 config_.ReceivedInitialCongestionWindow());
131 EXPECT_EQ(QuicTime::Delta::FromSeconds(0), config_.keepalive_timeout()); 137 EXPECT_EQ(QuicTime::Delta::FromSeconds(0), config_.keepalive_timeout());
132 EXPECT_EQ(10 * base::Time::kMicrosecondsPerMillisecond, 138 EXPECT_EQ(10 * base::Time::kMicrosecondsPerMillisecond,
133 config_.ReceivedInitialRoundTripTimeUs()); 139 config_.ReceivedInitialRoundTripTimeUs());
134 EXPECT_FALSE(config_.HasReceivedLossDetection()); 140 EXPECT_FALSE(config_.HasReceivedLossDetection());
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 const QuicErrorCode error = 210 const QuicErrorCode error =
205 config_.ProcessPeerHello(msg, SERVER, &error_details); 211 config_.ProcessPeerHello(msg, SERVER, &error_details);
206 EXPECT_EQ(QUIC_INVALID_NEGOTIATED_VALUE, error); 212 EXPECT_EQ(QUIC_INVALID_NEGOTIATED_VALUE, error);
207 } 213 }
208 214
209 TEST_F(QuicConfigTest, MultipleNegotiatedValuesInVectorTag) { 215 TEST_F(QuicConfigTest, MultipleNegotiatedValuesInVectorTag) {
210 QuicConfig server_config; 216 QuicConfig server_config;
211 QuicTagVector cgst; 217 QuicTagVector cgst;
212 cgst.push_back(kQBIC); 218 cgst.push_back(kQBIC);
213 cgst.push_back(kINAR); 219 cgst.push_back(kINAR);
214 server_config.set_congestion_control(cgst, kQBIC); 220 server_config.set_congestion_feedback(cgst, kQBIC);
215 221
216 CryptoHandshakeMessage msg; 222 CryptoHandshakeMessage msg;
217 server_config.ToHandshakeMessage(&msg); 223 server_config.ToHandshakeMessage(&msg);
218 string error_details; 224 string error_details;
219 const QuicErrorCode error = 225 const QuicErrorCode error =
220 config_.ProcessPeerHello(msg, SERVER, &error_details); 226 config_.ProcessPeerHello(msg, SERVER, &error_details);
221 EXPECT_EQ(QUIC_INVALID_NEGOTIATED_VALUE, error); 227 EXPECT_EQ(QUIC_INVALID_NEGOTIATED_VALUE, error);
222 } 228 }
223 229
224 TEST_F(QuicConfigTest, NoOverLapInCGST) { 230 TEST_F(QuicConfigTest, NoOverLapInCGST) {
225 QuicConfig server_config; 231 QuicConfig server_config;
226 server_config.SetDefaults(); 232 server_config.SetDefaults();
227 QuicTagVector cgst; 233 QuicTagVector cgst;
228 cgst.push_back(kINAR); 234 cgst.push_back(kINAR);
229 server_config.set_congestion_control(cgst, kINAR); 235 server_config.set_congestion_feedback(cgst, kINAR);
230 236
231 CryptoHandshakeMessage msg; 237 CryptoHandshakeMessage msg;
232 string error_details; 238 string error_details;
233 server_config.ToHandshakeMessage(&msg); 239 server_config.ToHandshakeMessage(&msg);
234 const QuicErrorCode error = 240 const QuicErrorCode error =
235 config_.ProcessPeerHello(msg, CLIENT, &error_details); 241 config_.ProcessPeerHello(msg, CLIENT, &error_details);
236 DVLOG(1) << QuicUtils::ErrorToString(error); 242 DVLOG(1) << QuicUtils::ErrorToString(error);
237 EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP, error); 243 EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP, error);
238 } 244 }
239 245
240 } // namespace 246 } // namespace
241 } // namespace test 247 } // namespace test
242 } // namespace net 248 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_config.cc ('k') | net/quic/quic_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698