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

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

Issue 2825773002: Deprecate FLAGS_quic_reloadable_flag_quic_no_socket_receive_buffer. (Closed)
Patch Set: Created 3 years, 8 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/core/quic_config.cc ('k') | net/quic/core/quic_flags_list.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/core/quic_config.h" 5 #include "net/quic/core/quic_config.h"
6 6
7 #include "net/quic/core/crypto/crypto_handshake_message.h" 7 #include "net/quic/core/crypto/crypto_handshake_message.h"
8 #include "net/quic/core/crypto/crypto_protocol.h" 8 #include "net/quic/core/crypto/crypto_protocol.h"
9 #include "net/quic/core/quic_packets.h" 9 #include "net/quic/core/quic_packets.h"
10 #include "net/quic/core/quic_time.h" 10 #include "net/quic/core/quic_time.h"
(...skipping 15 matching lines...) Expand all
26 }; 26 };
27 27
28 TEST_F(QuicConfigTest, ToHandshakeMessage) { 28 TEST_F(QuicConfigTest, ToHandshakeMessage) {
29 config_.SetInitialStreamFlowControlWindowToSend( 29 config_.SetInitialStreamFlowControlWindowToSend(
30 kInitialStreamFlowControlWindowForTest); 30 kInitialStreamFlowControlWindowForTest);
31 config_.SetInitialSessionFlowControlWindowToSend( 31 config_.SetInitialSessionFlowControlWindowToSend(
32 kInitialSessionFlowControlWindowForTest); 32 kInitialSessionFlowControlWindowForTest);
33 config_.SetIdleNetworkTimeout(QuicTime::Delta::FromSeconds(5), 33 config_.SetIdleNetworkTimeout(QuicTime::Delta::FromSeconds(5),
34 QuicTime::Delta::FromSeconds(2)); 34 QuicTime::Delta::FromSeconds(2));
35 config_.SetMaxStreamsPerConnection(4, 2); 35 config_.SetMaxStreamsPerConnection(4, 2);
36 if (!FLAGS_quic_reloadable_flag_quic_no_socket_receive_buffer) {
37 config_.SetSocketReceiveBufferToSend(kDefaultSocketReceiveBuffer);
38 }
39 CryptoHandshakeMessage msg; 36 CryptoHandshakeMessage msg;
40 config_.ToHandshakeMessage(&msg); 37 config_.ToHandshakeMessage(&msg);
41 38
42 uint32_t value; 39 uint32_t value;
43 QuicErrorCode error = msg.GetUint32(kICSL, &value); 40 QuicErrorCode error = msg.GetUint32(kICSL, &value);
44 EXPECT_EQ(QUIC_NO_ERROR, error); 41 EXPECT_EQ(QUIC_NO_ERROR, error);
45 EXPECT_EQ(5u, value); 42 EXPECT_EQ(5u, value);
46 43
47 error = msg.GetUint32(kMSPC, &value); 44 error = msg.GetUint32(kMSPC, &value);
48 EXPECT_EQ(QUIC_NO_ERROR, error); 45 EXPECT_EQ(QUIC_NO_ERROR, error);
49 EXPECT_EQ(4u, value); 46 EXPECT_EQ(4u, value);
50 47
51 error = msg.GetUint32(kSFCW, &value); 48 error = msg.GetUint32(kSFCW, &value);
52 EXPECT_EQ(QUIC_NO_ERROR, error); 49 EXPECT_EQ(QUIC_NO_ERROR, error);
53 EXPECT_EQ(kInitialStreamFlowControlWindowForTest, value); 50 EXPECT_EQ(kInitialStreamFlowControlWindowForTest, value);
54 51
55 error = msg.GetUint32(kCFCW, &value); 52 error = msg.GetUint32(kCFCW, &value);
56 EXPECT_EQ(QUIC_NO_ERROR, error); 53 EXPECT_EQ(QUIC_NO_ERROR, error);
57 EXPECT_EQ(kInitialSessionFlowControlWindowForTest, value); 54 EXPECT_EQ(kInitialSessionFlowControlWindowForTest, value);
58
59 if (!FLAGS_quic_reloadable_flag_quic_no_socket_receive_buffer) {
60 error = msg.GetUint32(kSRBF, &value);
61 EXPECT_EQ(QUIC_NO_ERROR, error);
62 EXPECT_EQ(kDefaultSocketReceiveBuffer, value);
63 }
64 } 55 }
65 56
66 TEST_F(QuicConfigTest, ProcessClientHello) { 57 TEST_F(QuicConfigTest, ProcessClientHello) {
67 QuicConfig client_config; 58 QuicConfig client_config;
68 QuicTagVector cgst; 59 QuicTagVector cgst;
69 cgst.push_back(kQBIC); 60 cgst.push_back(kQBIC);
70 client_config.SetIdleNetworkTimeout( 61 client_config.SetIdleNetworkTimeout(
71 QuicTime::Delta::FromSeconds(2 * kMaximumIdleTimeoutSecs), 62 QuicTime::Delta::FromSeconds(2 * kMaximumIdleTimeoutSecs),
72 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs)); 63 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs));
73 client_config.SetMaxStreamsPerConnection(2 * kDefaultMaxStreamsPerConnection, 64 client_config.SetMaxStreamsPerConnection(2 * kDefaultMaxStreamsPerConnection,
74 kDefaultMaxStreamsPerConnection); 65 kDefaultMaxStreamsPerConnection);
75 client_config.SetInitialRoundTripTimeUsToSend(10 * kNumMicrosPerMilli); 66 client_config.SetInitialRoundTripTimeUsToSend(10 * kNumMicrosPerMilli);
76 client_config.SetInitialStreamFlowControlWindowToSend( 67 client_config.SetInitialStreamFlowControlWindowToSend(
77 2 * kInitialStreamFlowControlWindowForTest); 68 2 * kInitialStreamFlowControlWindowForTest);
78 client_config.SetInitialSessionFlowControlWindowToSend( 69 client_config.SetInitialSessionFlowControlWindowToSend(
79 2 * kInitialSessionFlowControlWindowForTest); 70 2 * kInitialSessionFlowControlWindowForTest);
80 if (!FLAGS_quic_reloadable_flag_quic_no_socket_receive_buffer) {
81 client_config.SetSocketReceiveBufferToSend(kDefaultSocketReceiveBuffer);
82 }
83 client_config.SetForceHolBlocking(); 71 client_config.SetForceHolBlocking();
84 QuicTagVector copt; 72 QuicTagVector copt;
85 copt.push_back(kTBBR); 73 copt.push_back(kTBBR);
86 client_config.SetConnectionOptionsToSend(copt); 74 client_config.SetConnectionOptionsToSend(copt);
87 CryptoHandshakeMessage msg; 75 CryptoHandshakeMessage msg;
88 client_config.ToHandshakeMessage(&msg); 76 client_config.ToHandshakeMessage(&msg);
89 77
90 string error_details; 78 string error_details;
91 QuicTagVector initial_received_options; 79 QuicTagVector initial_received_options;
92 initial_received_options.push_back(kIW50); 80 initial_received_options.push_back(kIW50);
(...skipping 15 matching lines...) Expand all
108 EXPECT_EQ(10 * kNumMicrosPerMilli, config_.ReceivedInitialRoundTripTimeUs()); 96 EXPECT_EQ(10 * kNumMicrosPerMilli, config_.ReceivedInitialRoundTripTimeUs());
109 EXPECT_TRUE(config_.ForceHolBlocking(Perspective::IS_SERVER)); 97 EXPECT_TRUE(config_.ForceHolBlocking(Perspective::IS_SERVER));
110 EXPECT_TRUE(config_.HasReceivedConnectionOptions()); 98 EXPECT_TRUE(config_.HasReceivedConnectionOptions());
111 EXPECT_EQ(2u, config_.ReceivedConnectionOptions().size()); 99 EXPECT_EQ(2u, config_.ReceivedConnectionOptions().size());
112 EXPECT_EQ(config_.ReceivedConnectionOptions()[0], kIW50); 100 EXPECT_EQ(config_.ReceivedConnectionOptions()[0], kIW50);
113 EXPECT_EQ(config_.ReceivedConnectionOptions()[1], kTBBR); 101 EXPECT_EQ(config_.ReceivedConnectionOptions()[1], kTBBR);
114 EXPECT_EQ(config_.ReceivedInitialStreamFlowControlWindowBytes(), 102 EXPECT_EQ(config_.ReceivedInitialStreamFlowControlWindowBytes(),
115 2 * kInitialStreamFlowControlWindowForTest); 103 2 * kInitialStreamFlowControlWindowForTest);
116 EXPECT_EQ(config_.ReceivedInitialSessionFlowControlWindowBytes(), 104 EXPECT_EQ(config_.ReceivedInitialSessionFlowControlWindowBytes(),
117 2 * kInitialSessionFlowControlWindowForTest); 105 2 * kInitialSessionFlowControlWindowForTest);
118 if (!FLAGS_quic_reloadable_flag_quic_no_socket_receive_buffer) {
119 EXPECT_EQ(config_.ReceivedSocketReceiveBuffer(),
120 kDefaultSocketReceiveBuffer);
121 }
122 } 106 }
123 107
124 TEST_F(QuicConfigTest, ProcessServerHello) { 108 TEST_F(QuicConfigTest, ProcessServerHello) {
125 QuicIpAddress host; 109 QuicIpAddress host;
126 host.FromString("127.0.3.1"); 110 host.FromString("127.0.3.1");
127 const QuicSocketAddress kTestServerAddress = QuicSocketAddress(host, 1234); 111 const QuicSocketAddress kTestServerAddress = QuicSocketAddress(host, 1234);
128 QuicConfig server_config; 112 QuicConfig server_config;
129 QuicTagVector cgst; 113 QuicTagVector cgst;
130 cgst.push_back(kQBIC); 114 cgst.push_back(kQBIC);
131 server_config.SetIdleNetworkTimeout( 115 server_config.SetIdleNetworkTimeout(
132 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2), 116 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2),
133 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2)); 117 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2));
134 server_config.SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection / 2, 118 server_config.SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection / 2,
135 kDefaultMaxStreamsPerConnection / 2); 119 kDefaultMaxStreamsPerConnection / 2);
136 server_config.SetInitialRoundTripTimeUsToSend(10 * kNumMicrosPerMilli); 120 server_config.SetInitialRoundTripTimeUsToSend(10 * kNumMicrosPerMilli);
137 server_config.SetInitialStreamFlowControlWindowToSend( 121 server_config.SetInitialStreamFlowControlWindowToSend(
138 2 * kInitialStreamFlowControlWindowForTest); 122 2 * kInitialStreamFlowControlWindowForTest);
139 server_config.SetInitialSessionFlowControlWindowToSend( 123 server_config.SetInitialSessionFlowControlWindowToSend(
140 2 * kInitialSessionFlowControlWindowForTest); 124 2 * kInitialSessionFlowControlWindowForTest);
141 if (!FLAGS_quic_reloadable_flag_quic_no_socket_receive_buffer) {
142 server_config.SetSocketReceiveBufferToSend(kDefaultSocketReceiveBuffer);
143 }
144 server_config.SetAlternateServerAddressToSend(kTestServerAddress); 125 server_config.SetAlternateServerAddressToSend(kTestServerAddress);
145 CryptoHandshakeMessage msg; 126 CryptoHandshakeMessage msg;
146 server_config.ToHandshakeMessage(&msg); 127 server_config.ToHandshakeMessage(&msg);
147 string error_details; 128 string error_details;
148 const QuicErrorCode error = 129 const QuicErrorCode error =
149 config_.ProcessPeerHello(msg, SERVER, &error_details); 130 config_.ProcessPeerHello(msg, SERVER, &error_details);
150 EXPECT_EQ(QUIC_NO_ERROR, error); 131 EXPECT_EQ(QUIC_NO_ERROR, error);
151 EXPECT_TRUE(config_.negotiated()); 132 EXPECT_TRUE(config_.negotiated());
152 EXPECT_EQ(QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2), 133 EXPECT_EQ(QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2),
153 config_.IdleNetworkTimeout()); 134 config_.IdleNetworkTimeout());
154 EXPECT_EQ(kDefaultMaxStreamsPerConnection / 2, 135 EXPECT_EQ(kDefaultMaxStreamsPerConnection / 2,
155 config_.MaxStreamsPerConnection()); 136 config_.MaxStreamsPerConnection());
156 EXPECT_EQ(10 * kNumMicrosPerMilli, config_.ReceivedInitialRoundTripTimeUs()); 137 EXPECT_EQ(10 * kNumMicrosPerMilli, config_.ReceivedInitialRoundTripTimeUs());
157 EXPECT_EQ(config_.ReceivedInitialStreamFlowControlWindowBytes(), 138 EXPECT_EQ(config_.ReceivedInitialStreamFlowControlWindowBytes(),
158 2 * kInitialStreamFlowControlWindowForTest); 139 2 * kInitialStreamFlowControlWindowForTest);
159 EXPECT_EQ(config_.ReceivedInitialSessionFlowControlWindowBytes(), 140 EXPECT_EQ(config_.ReceivedInitialSessionFlowControlWindowBytes(),
160 2 * kInitialSessionFlowControlWindowForTest); 141 2 * kInitialSessionFlowControlWindowForTest);
161 if (!FLAGS_quic_reloadable_flag_quic_no_socket_receive_buffer) {
162 EXPECT_EQ(config_.ReceivedSocketReceiveBuffer(),
163 kDefaultSocketReceiveBuffer);
164 }
165 EXPECT_TRUE(config_.HasReceivedAlternateServerAddress()); 142 EXPECT_TRUE(config_.HasReceivedAlternateServerAddress());
166 EXPECT_EQ(kTestServerAddress, config_.ReceivedAlternateServerAddress()); 143 EXPECT_EQ(kTestServerAddress, config_.ReceivedAlternateServerAddress());
167 } 144 }
168 145
169 TEST_F(QuicConfigTest, MissingOptionalValuesInCHLO) { 146 TEST_F(QuicConfigTest, MissingOptionalValuesInCHLO) {
170 CryptoHandshakeMessage msg; 147 CryptoHandshakeMessage msg;
171 msg.SetValue(kICSL, 1); 148 msg.SetValue(kICSL, 1);
172 149
173 // Set all REQUIRED tags. 150 // Set all REQUIRED tags.
174 msg.SetValue(kICSL, 1); 151 msg.SetValue(kICSL, 1);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 EXPECT_EQ(1u, config_.ReceivedConnectionOptions().size()); 288 EXPECT_EQ(1u, config_.ReceivedConnectionOptions().size());
312 EXPECT_FALSE(config_.HasClientRequestedIndependentOption( 289 EXPECT_FALSE(config_.HasClientRequestedIndependentOption(
313 kRENO, Perspective::IS_SERVER)); 290 kRENO, Perspective::IS_SERVER));
314 EXPECT_TRUE(config_.HasClientRequestedIndependentOption( 291 EXPECT_TRUE(config_.HasClientRequestedIndependentOption(
315 kTBBR, Perspective::IS_SERVER)); 292 kTBBR, Perspective::IS_SERVER));
316 } 293 }
317 294
318 } // namespace 295 } // namespace
319 } // namespace test 296 } // namespace test
320 } // namespace net 297 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_config.cc ('k') | net/quic/core/quic_flags_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698