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

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

Issue 572083003: Add a separate QUIC_CONNECTION_OVERALL_TIMED_OUT to identify overall (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Fix_crash_on_ConnectionClose_75541290
Patch Set: Created 6 years, 3 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
« no previous file with comments | « net/quic/quic_config.cc ('k') | net/quic/quic_connection.cc » ('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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 EXPECT_EQ(1u, out_len); 76 EXPECT_EQ(1u, out_len);
77 EXPECT_EQ(kQBIC, *out); 77 EXPECT_EQ(kQBIC, *out);
78 } 78 }
79 79
80 TEST_F(QuicConfigTest, ProcessClientHello) { 80 TEST_F(QuicConfigTest, ProcessClientHello) {
81 QuicConfig client_config; 81 QuicConfig client_config;
82 QuicTagVector cgst; 82 QuicTagVector cgst;
83 cgst.push_back(kQBIC); 83 cgst.push_back(kQBIC);
84 client_config.set_congestion_feedback(cgst, kQBIC); 84 client_config.set_congestion_feedback(cgst, kQBIC);
85 client_config.set_idle_connection_state_lifetime( 85 client_config.set_idle_connection_state_lifetime(
86 QuicTime::Delta::FromSeconds(2 * kDefaultTimeoutSecs), 86 QuicTime::Delta::FromSeconds(2 * kMaximumIdleTimeoutSecs),
87 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs)); 87 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs));
88 client_config.set_max_streams_per_connection( 88 client_config.set_max_streams_per_connection(
89 2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection); 89 2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection);
90 client_config.SetInitialRoundTripTimeUsToSend( 90 client_config.SetInitialRoundTripTimeUsToSend(
91 10 * base::Time::kMicrosecondsPerMillisecond); 91 10 * base::Time::kMicrosecondsPerMillisecond);
92 client_config.SetInitialFlowControlWindowToSend( 92 client_config.SetInitialFlowControlWindowToSend(
93 2 * kInitialSessionFlowControlWindowForTest); 93 2 * kInitialSessionFlowControlWindowForTest);
94 client_config.SetInitialStreamFlowControlWindowToSend( 94 client_config.SetInitialStreamFlowControlWindowToSend(
95 2 * kInitialStreamFlowControlWindowForTest); 95 2 * kInitialStreamFlowControlWindowForTest);
96 client_config.SetInitialSessionFlowControlWindowToSend( 96 client_config.SetInitialSessionFlowControlWindowToSend(
97 2 * kInitialSessionFlowControlWindowForTest); 97 2 * kInitialSessionFlowControlWindowForTest);
98 client_config.SetSocketReceiveBufferToSend(kDefaultSocketReceiveBuffer); 98 client_config.SetSocketReceiveBufferToSend(kDefaultSocketReceiveBuffer);
99 QuicTagVector copt; 99 QuicTagVector copt;
100 copt.push_back(kTBBR); 100 copt.push_back(kTBBR);
101 copt.push_back(kFHDR); 101 copt.push_back(kFHDR);
102 client_config.SetConnectionOptionsToSend(copt); 102 client_config.SetConnectionOptionsToSend(copt);
103 CryptoHandshakeMessage msg; 103 CryptoHandshakeMessage msg;
104 client_config.ToHandshakeMessage(&msg); 104 client_config.ToHandshakeMessage(&msg);
105 string error_details; 105 string error_details;
106 const QuicErrorCode error = 106 const QuicErrorCode error =
107 config_.ProcessPeerHello(msg, CLIENT, &error_details); 107 config_.ProcessPeerHello(msg, CLIENT, &error_details);
108 EXPECT_EQ(QUIC_NO_ERROR, error); 108 EXPECT_EQ(QUIC_NO_ERROR, error);
109 EXPECT_TRUE(config_.negotiated()); 109 EXPECT_TRUE(config_.negotiated());
110 EXPECT_EQ(kQBIC, config_.congestion_feedback()); 110 EXPECT_EQ(kQBIC, config_.congestion_feedback());
111 EXPECT_EQ(QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs), 111 EXPECT_EQ(QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs),
112 config_.idle_connection_state_lifetime()); 112 config_.idle_connection_state_lifetime());
113 EXPECT_EQ(kDefaultMaxStreamsPerConnection, 113 EXPECT_EQ(kDefaultMaxStreamsPerConnection,
114 config_.max_streams_per_connection()); 114 config_.max_streams_per_connection());
115 EXPECT_EQ(QuicTime::Delta::FromSeconds(0), config_.keepalive_timeout()); 115 EXPECT_EQ(QuicTime::Delta::FromSeconds(0), config_.keepalive_timeout());
116 EXPECT_EQ(10 * base::Time::kMicrosecondsPerMillisecond, 116 EXPECT_EQ(10 * base::Time::kMicrosecondsPerMillisecond,
117 config_.ReceivedInitialRoundTripTimeUs()); 117 config_.ReceivedInitialRoundTripTimeUs());
118 EXPECT_FALSE(config_.HasReceivedLossDetection()); 118 EXPECT_FALSE(config_.HasReceivedLossDetection());
119 EXPECT_TRUE(config_.HasReceivedConnectionOptions()); 119 EXPECT_TRUE(config_.HasReceivedConnectionOptions());
120 EXPECT_EQ(2u, config_.ReceivedConnectionOptions().size()); 120 EXPECT_EQ(2u, config_.ReceivedConnectionOptions().size());
121 EXPECT_EQ(config_.ReceivedConnectionOptions()[0], kTBBR); 121 EXPECT_EQ(config_.ReceivedConnectionOptions()[0], kTBBR);
122 EXPECT_EQ(config_.ReceivedConnectionOptions()[1], kFHDR); 122 EXPECT_EQ(config_.ReceivedConnectionOptions()[1], kFHDR);
123 EXPECT_EQ(config_.ReceivedInitialFlowControlWindowBytes(), 123 EXPECT_EQ(config_.ReceivedInitialFlowControlWindowBytes(),
124 2 * kInitialSessionFlowControlWindowForTest); 124 2 * kInitialSessionFlowControlWindowForTest);
125 EXPECT_EQ(config_.ReceivedInitialStreamFlowControlWindowBytes(), 125 EXPECT_EQ(config_.ReceivedInitialStreamFlowControlWindowBytes(),
126 2 * kInitialStreamFlowControlWindowForTest); 126 2 * kInitialStreamFlowControlWindowForTest);
127 EXPECT_EQ(config_.ReceivedInitialSessionFlowControlWindowBytes(), 127 EXPECT_EQ(config_.ReceivedInitialSessionFlowControlWindowBytes(),
128 2 * kInitialSessionFlowControlWindowForTest); 128 2 * kInitialSessionFlowControlWindowForTest);
129 EXPECT_EQ(config_.ReceivedSocketReceiveBuffer(), 129 EXPECT_EQ(config_.ReceivedSocketReceiveBuffer(),
130 kDefaultSocketReceiveBuffer); 130 kDefaultSocketReceiveBuffer);
131 } 131 }
132 132
133 TEST_F(QuicConfigTest, ProcessServerHello) { 133 TEST_F(QuicConfigTest, ProcessServerHello) {
134 QuicConfig server_config; 134 QuicConfig server_config;
135 QuicTagVector cgst; 135 QuicTagVector cgst;
136 cgst.push_back(kQBIC); 136 cgst.push_back(kQBIC);
137 server_config.set_congestion_feedback(cgst, kQBIC); 137 server_config.set_congestion_feedback(cgst, kQBIC);
138 server_config.set_idle_connection_state_lifetime( 138 server_config.set_idle_connection_state_lifetime(
139 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs / 2), 139 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2),
140 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs / 2)); 140 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2));
141 server_config.set_max_streams_per_connection( 141 server_config.set_max_streams_per_connection(
142 kDefaultMaxStreamsPerConnection / 2, 142 kDefaultMaxStreamsPerConnection / 2,
143 kDefaultMaxStreamsPerConnection / 2); 143 kDefaultMaxStreamsPerConnection / 2);
144 server_config.SetInitialCongestionWindowToSend(kDefaultInitialWindow / 2); 144 server_config.SetInitialCongestionWindowToSend(kDefaultInitialWindow / 2);
145 server_config.SetInitialRoundTripTimeUsToSend( 145 server_config.SetInitialRoundTripTimeUsToSend(
146 10 * base::Time::kMicrosecondsPerMillisecond); 146 10 * base::Time::kMicrosecondsPerMillisecond);
147 server_config.SetInitialFlowControlWindowToSend( 147 server_config.SetInitialFlowControlWindowToSend(
148 2 * kInitialSessionFlowControlWindowForTest); 148 2 * kInitialSessionFlowControlWindowForTest);
149 server_config.SetInitialStreamFlowControlWindowToSend( 149 server_config.SetInitialStreamFlowControlWindowToSend(
150 2 * kInitialStreamFlowControlWindowForTest); 150 2 * kInitialStreamFlowControlWindowForTest);
151 server_config.SetInitialSessionFlowControlWindowToSend( 151 server_config.SetInitialSessionFlowControlWindowToSend(
152 2 * kInitialSessionFlowControlWindowForTest); 152 2 * kInitialSessionFlowControlWindowForTest);
153 server_config.SetSocketReceiveBufferToSend(kDefaultSocketReceiveBuffer); 153 server_config.SetSocketReceiveBufferToSend(kDefaultSocketReceiveBuffer);
154 CryptoHandshakeMessage msg; 154 CryptoHandshakeMessage msg;
155 server_config.ToHandshakeMessage(&msg); 155 server_config.ToHandshakeMessage(&msg);
156 string error_details; 156 string error_details;
157 const QuicErrorCode error = 157 const QuicErrorCode error =
158 config_.ProcessPeerHello(msg, SERVER, &error_details); 158 config_.ProcessPeerHello(msg, SERVER, &error_details);
159 EXPECT_EQ(QUIC_NO_ERROR, error); 159 EXPECT_EQ(QUIC_NO_ERROR, error);
160 EXPECT_TRUE(config_.negotiated()); 160 EXPECT_TRUE(config_.negotiated());
161 EXPECT_EQ(kQBIC, config_.congestion_feedback()); 161 EXPECT_EQ(kQBIC, config_.congestion_feedback());
162 EXPECT_EQ(QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs / 2), 162 EXPECT_EQ(QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2),
163 config_.idle_connection_state_lifetime()); 163 config_.idle_connection_state_lifetime());
164 EXPECT_EQ(kDefaultMaxStreamsPerConnection / 2, 164 EXPECT_EQ(kDefaultMaxStreamsPerConnection / 2,
165 config_.max_streams_per_connection()); 165 config_.max_streams_per_connection());
166 EXPECT_EQ(kDefaultInitialWindow / 2, 166 EXPECT_EQ(kDefaultInitialWindow / 2,
167 config_.ReceivedInitialCongestionWindow()); 167 config_.ReceivedInitialCongestionWindow());
168 EXPECT_EQ(QuicTime::Delta::FromSeconds(0), config_.keepalive_timeout()); 168 EXPECT_EQ(QuicTime::Delta::FromSeconds(0), config_.keepalive_timeout());
169 EXPECT_EQ(10 * base::Time::kMicrosecondsPerMillisecond, 169 EXPECT_EQ(10 * base::Time::kMicrosecondsPerMillisecond,
170 config_.ReceivedInitialRoundTripTimeUs()); 170 config_.ReceivedInitialRoundTripTimeUs());
171 EXPECT_FALSE(config_.HasReceivedLossDetection()); 171 EXPECT_FALSE(config_.HasReceivedLossDetection());
172 EXPECT_EQ(config_.ReceivedInitialFlowControlWindowBytes(), 172 EXPECT_EQ(config_.ReceivedInitialFlowControlWindowBytes(),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // Missing CGST. KATO is optional. 233 // Missing CGST. KATO is optional.
234 string error_details; 234 string error_details;
235 const QuicErrorCode error = 235 const QuicErrorCode error =
236 config_.ProcessPeerHello(msg, SERVER, &error_details); 236 config_.ProcessPeerHello(msg, SERVER, &error_details);
237 EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, error); 237 EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, error);
238 } 238 }
239 239
240 TEST_F(QuicConfigTest, OutOfBoundSHLO) { 240 TEST_F(QuicConfigTest, OutOfBoundSHLO) {
241 QuicConfig server_config; 241 QuicConfig server_config;
242 server_config.set_idle_connection_state_lifetime( 242 server_config.set_idle_connection_state_lifetime(
243 QuicTime::Delta::FromSeconds(2 * kDefaultTimeoutSecs), 243 QuicTime::Delta::FromSeconds(2 * kMaximumIdleTimeoutSecs),
244 QuicTime::Delta::FromSeconds(2 * kDefaultTimeoutSecs)); 244 QuicTime::Delta::FromSeconds(2 * kMaximumIdleTimeoutSecs));
245 245
246 CryptoHandshakeMessage msg; 246 CryptoHandshakeMessage msg;
247 server_config.ToHandshakeMessage(&msg); 247 server_config.ToHandshakeMessage(&msg);
248 string error_details; 248 string error_details;
249 const QuicErrorCode error = 249 const QuicErrorCode error =
250 config_.ProcessPeerHello(msg, SERVER, &error_details); 250 config_.ProcessPeerHello(msg, SERVER, &error_details);
251 EXPECT_EQ(QUIC_INVALID_NEGOTIATED_VALUE, error); 251 EXPECT_EQ(QUIC_INVALID_NEGOTIATED_VALUE, error);
252 } 252 }
253 253
254 TEST_F(QuicConfigTest, MultipleNegotiatedValuesInVectorTag) { 254 TEST_F(QuicConfigTest, MultipleNegotiatedValuesInVectorTag) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 EXPECT_DFATAL(config.SetInitialFlowControlWindowToSend(kInvalidWindow), 290 EXPECT_DFATAL(config.SetInitialFlowControlWindowToSend(kInvalidWindow),
291 "Initial flow control receive window"); 291 "Initial flow control receive window");
292 292
293 EXPECT_EQ(kDefaultFlowControlSendWindow, 293 EXPECT_EQ(kDefaultFlowControlSendWindow,
294 config.GetInitialFlowControlWindowToSend()); 294 config.GetInitialFlowControlWindowToSend());
295 } 295 }
296 296
297 } // namespace 297 } // namespace
298 } // namespace test 298 } // namespace test
299 } // namespace net 299 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_config.cc ('k') | net/quic/quic_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698