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

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

Issue 2011933002: Add alternate server address to QuicConfig. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@122546126
Patch Set: Created 4 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
« no previous file with comments | « net/quic/quic_config.cc ('k') | no next file » | 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 EXPECT_EQ(config_.ReceivedConnectionOptions()[0], kIW50); 105 EXPECT_EQ(config_.ReceivedConnectionOptions()[0], kIW50);
106 EXPECT_EQ(config_.ReceivedConnectionOptions()[1], kTBBR); 106 EXPECT_EQ(config_.ReceivedConnectionOptions()[1], kTBBR);
107 EXPECT_EQ(config_.ReceivedInitialStreamFlowControlWindowBytes(), 107 EXPECT_EQ(config_.ReceivedInitialStreamFlowControlWindowBytes(),
108 2 * kInitialStreamFlowControlWindowForTest); 108 2 * kInitialStreamFlowControlWindowForTest);
109 EXPECT_EQ(config_.ReceivedInitialSessionFlowControlWindowBytes(), 109 EXPECT_EQ(config_.ReceivedInitialSessionFlowControlWindowBytes(),
110 2 * kInitialSessionFlowControlWindowForTest); 110 2 * kInitialSessionFlowControlWindowForTest);
111 EXPECT_EQ(config_.ReceivedSocketReceiveBuffer(), kDefaultSocketReceiveBuffer); 111 EXPECT_EQ(config_.ReceivedSocketReceiveBuffer(), kDefaultSocketReceiveBuffer);
112 } 112 }
113 113
114 TEST_F(QuicConfigTest, ProcessServerHello) { 114 TEST_F(QuicConfigTest, ProcessServerHello) {
115 const IPEndPoint kTestServerAddress(IPAddress(127, 0, 3, 1), 1234);
115 QuicConfig server_config; 116 QuicConfig server_config;
116 QuicTagVector cgst; 117 QuicTagVector cgst;
117 cgst.push_back(kQBIC); 118 cgst.push_back(kQBIC);
118 server_config.SetIdleConnectionStateLifetime( 119 server_config.SetIdleConnectionStateLifetime(
119 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2), 120 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2),
120 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2)); 121 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2));
121 server_config.SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection / 2, 122 server_config.SetMaxStreamsPerConnection(kDefaultMaxStreamsPerConnection / 2,
122 kDefaultMaxStreamsPerConnection / 2); 123 kDefaultMaxStreamsPerConnection / 2);
123 server_config.SetInitialRoundTripTimeUsToSend(10 * kNumMicrosPerMilli); 124 server_config.SetInitialRoundTripTimeUsToSend(10 * kNumMicrosPerMilli);
124 server_config.SetInitialStreamFlowControlWindowToSend( 125 server_config.SetInitialStreamFlowControlWindowToSend(
125 2 * kInitialStreamFlowControlWindowForTest); 126 2 * kInitialStreamFlowControlWindowForTest);
126 server_config.SetInitialSessionFlowControlWindowToSend( 127 server_config.SetInitialSessionFlowControlWindowToSend(
127 2 * kInitialSessionFlowControlWindowForTest); 128 2 * kInitialSessionFlowControlWindowForTest);
128 server_config.SetSocketReceiveBufferToSend(kDefaultSocketReceiveBuffer); 129 server_config.SetSocketReceiveBufferToSend(kDefaultSocketReceiveBuffer);
130 server_config.SetAlternateServerAddressToSend(kTestServerAddress);
129 CryptoHandshakeMessage msg; 131 CryptoHandshakeMessage msg;
130 server_config.ToHandshakeMessage(&msg); 132 server_config.ToHandshakeMessage(&msg);
131 string error_details; 133 string error_details;
132 const QuicErrorCode error = 134 const QuicErrorCode error =
133 config_.ProcessPeerHello(msg, SERVER, &error_details); 135 config_.ProcessPeerHello(msg, SERVER, &error_details);
134 EXPECT_EQ(QUIC_NO_ERROR, error); 136 EXPECT_EQ(QUIC_NO_ERROR, error);
135 EXPECT_TRUE(config_.negotiated()); 137 EXPECT_TRUE(config_.negotiated());
136 EXPECT_EQ(QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2), 138 EXPECT_EQ(QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs / 2),
137 config_.IdleConnectionStateLifetime()); 139 config_.IdleConnectionStateLifetime());
138 EXPECT_EQ(kDefaultMaxStreamsPerConnection / 2, 140 EXPECT_EQ(kDefaultMaxStreamsPerConnection / 2,
139 config_.MaxStreamsPerConnection()); 141 config_.MaxStreamsPerConnection());
140 EXPECT_EQ(10 * kNumMicrosPerMilli, config_.ReceivedInitialRoundTripTimeUs()); 142 EXPECT_EQ(10 * kNumMicrosPerMilli, config_.ReceivedInitialRoundTripTimeUs());
141 EXPECT_EQ(config_.ReceivedInitialStreamFlowControlWindowBytes(), 143 EXPECT_EQ(config_.ReceivedInitialStreamFlowControlWindowBytes(),
142 2 * kInitialStreamFlowControlWindowForTest); 144 2 * kInitialStreamFlowControlWindowForTest);
143 EXPECT_EQ(config_.ReceivedInitialSessionFlowControlWindowBytes(), 145 EXPECT_EQ(config_.ReceivedInitialSessionFlowControlWindowBytes(),
144 2 * kInitialSessionFlowControlWindowForTest); 146 2 * kInitialSessionFlowControlWindowForTest);
145 EXPECT_EQ(config_.ReceivedSocketReceiveBuffer(), kDefaultSocketReceiveBuffer); 147 EXPECT_EQ(config_.ReceivedSocketReceiveBuffer(), kDefaultSocketReceiveBuffer);
148 EXPECT_TRUE(config_.HasReceivedAlternateServerAddress());
149 EXPECT_EQ(kTestServerAddress, config_.ReceivedAlternateServerAddress());
146 } 150 }
147 151
148 TEST_F(QuicConfigTest, MissingOptionalValuesInCHLO) { 152 TEST_F(QuicConfigTest, MissingOptionalValuesInCHLO) {
149 CryptoHandshakeMessage msg; 153 CryptoHandshakeMessage msg;
150 msg.SetValue(kICSL, 1); 154 msg.SetValue(kICSL, 1);
151 155
152 // Set all REQUIRED tags. 156 // Set all REQUIRED tags.
153 msg.SetValue(kICSL, 1); 157 msg.SetValue(kICSL, 1);
154 msg.SetValue(kMSPC, 1); 158 msg.SetValue(kMSPC, 1);
155 159
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 245
242 EXPECT_TRUE(config_.HasReceivedConnectionOptions()); 246 EXPECT_TRUE(config_.HasReceivedConnectionOptions());
243 EXPECT_EQ(1u, config_.ReceivedConnectionOptions().size()); 247 EXPECT_EQ(1u, config_.ReceivedConnectionOptions().size());
244 EXPECT_TRUE( 248 EXPECT_TRUE(
245 config_.HasClientSentConnectionOption(kTBBR, Perspective::IS_SERVER)); 249 config_.HasClientSentConnectionOption(kTBBR, Perspective::IS_SERVER));
246 } 250 }
247 251
248 } // namespace 252 } // namespace
249 } // namespace test 253 } // namespace test
250 } // namespace net 254 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_config.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698