OLD | NEW |
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_flags.h" | 9 #include "net/quic/core/quic_flags.h" |
10 #include "net/quic/core/quic_protocol.h" | 10 #include "net/quic/core/quic_protocol.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 QuicTime::Delta::FromSeconds(2 * kMaximumIdleTimeoutSecs), | 68 QuicTime::Delta::FromSeconds(2 * kMaximumIdleTimeoutSecs), |
69 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs)); | 69 QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs)); |
70 client_config.SetMaxStreamsPerConnection(2 * kDefaultMaxStreamsPerConnection, | 70 client_config.SetMaxStreamsPerConnection(2 * kDefaultMaxStreamsPerConnection, |
71 kDefaultMaxStreamsPerConnection); | 71 kDefaultMaxStreamsPerConnection); |
72 client_config.SetInitialRoundTripTimeUsToSend(10 * kNumMicrosPerMilli); | 72 client_config.SetInitialRoundTripTimeUsToSend(10 * kNumMicrosPerMilli); |
73 client_config.SetInitialStreamFlowControlWindowToSend( | 73 client_config.SetInitialStreamFlowControlWindowToSend( |
74 2 * kInitialStreamFlowControlWindowForTest); | 74 2 * kInitialStreamFlowControlWindowForTest); |
75 client_config.SetInitialSessionFlowControlWindowToSend( | 75 client_config.SetInitialSessionFlowControlWindowToSend( |
76 2 * kInitialSessionFlowControlWindowForTest); | 76 2 * kInitialSessionFlowControlWindowForTest); |
77 client_config.SetSocketReceiveBufferToSend(kDefaultSocketReceiveBuffer); | 77 client_config.SetSocketReceiveBufferToSend(kDefaultSocketReceiveBuffer); |
| 78 client_config.SetForceHolBlocking(); |
78 QuicTagVector copt; | 79 QuicTagVector copt; |
79 copt.push_back(kTBBR); | 80 copt.push_back(kTBBR); |
80 client_config.SetConnectionOptionsToSend(copt); | 81 client_config.SetConnectionOptionsToSend(copt); |
81 CryptoHandshakeMessage msg; | 82 CryptoHandshakeMessage msg; |
82 client_config.ToHandshakeMessage(&msg); | 83 client_config.ToHandshakeMessage(&msg); |
83 | 84 |
84 string error_details; | 85 string error_details; |
85 QuicTagVector initial_received_options; | 86 QuicTagVector initial_received_options; |
86 initial_received_options.push_back(kIW50); | 87 initial_received_options.push_back(kIW50); |
87 EXPECT_TRUE( | 88 EXPECT_TRUE( |
88 config_.SetInitialReceivedConnectionOptions(initial_received_options)); | 89 config_.SetInitialReceivedConnectionOptions(initial_received_options)); |
89 EXPECT_FALSE( | 90 EXPECT_FALSE( |
90 config_.SetInitialReceivedConnectionOptions(initial_received_options)) | 91 config_.SetInitialReceivedConnectionOptions(initial_received_options)) |
91 << "You can only set initial options once."; | 92 << "You can only set initial options once."; |
92 const QuicErrorCode error = | 93 const QuicErrorCode error = |
93 config_.ProcessPeerHello(msg, CLIENT, &error_details); | 94 config_.ProcessPeerHello(msg, CLIENT, &error_details); |
94 EXPECT_FALSE( | 95 EXPECT_FALSE( |
95 config_.SetInitialReceivedConnectionOptions(initial_received_options)) | 96 config_.SetInitialReceivedConnectionOptions(initial_received_options)) |
96 << "You cannot set initial options after the hello."; | 97 << "You cannot set initial options after the hello."; |
97 EXPECT_EQ(QUIC_NO_ERROR, error); | 98 EXPECT_EQ(QUIC_NO_ERROR, error); |
98 EXPECT_TRUE(config_.negotiated()); | 99 EXPECT_TRUE(config_.negotiated()); |
99 EXPECT_EQ(QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs), | 100 EXPECT_EQ(QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs), |
100 config_.IdleConnectionStateLifetime()); | 101 config_.IdleConnectionStateLifetime()); |
101 EXPECT_EQ(kDefaultMaxStreamsPerConnection, config_.MaxStreamsPerConnection()); | 102 EXPECT_EQ(kDefaultMaxStreamsPerConnection, config_.MaxStreamsPerConnection()); |
102 EXPECT_EQ(10 * kNumMicrosPerMilli, config_.ReceivedInitialRoundTripTimeUs()); | 103 EXPECT_EQ(10 * kNumMicrosPerMilli, config_.ReceivedInitialRoundTripTimeUs()); |
| 104 EXPECT_TRUE(config_.ForceHolBlocking(Perspective::IS_SERVER)); |
103 EXPECT_TRUE(config_.HasReceivedConnectionOptions()); | 105 EXPECT_TRUE(config_.HasReceivedConnectionOptions()); |
104 EXPECT_EQ(2u, config_.ReceivedConnectionOptions().size()); | 106 EXPECT_EQ(2u, config_.ReceivedConnectionOptions().size()); |
105 EXPECT_EQ(config_.ReceivedConnectionOptions()[0], kIW50); | 107 EXPECT_EQ(config_.ReceivedConnectionOptions()[0], kIW50); |
106 EXPECT_EQ(config_.ReceivedConnectionOptions()[1], kTBBR); | 108 EXPECT_EQ(config_.ReceivedConnectionOptions()[1], kTBBR); |
107 EXPECT_EQ(config_.ReceivedInitialStreamFlowControlWindowBytes(), | 109 EXPECT_EQ(config_.ReceivedInitialStreamFlowControlWindowBytes(), |
108 2 * kInitialStreamFlowControlWindowForTest); | 110 2 * kInitialStreamFlowControlWindowForTest); |
109 EXPECT_EQ(config_.ReceivedInitialSessionFlowControlWindowBytes(), | 111 EXPECT_EQ(config_.ReceivedInitialSessionFlowControlWindowBytes(), |
110 2 * kInitialSessionFlowControlWindowForTest); | 112 2 * kInitialSessionFlowControlWindowForTest); |
111 EXPECT_EQ(config_.ReceivedSocketReceiveBuffer(), kDefaultSocketReceiveBuffer); | 113 EXPECT_EQ(config_.ReceivedSocketReceiveBuffer(), kDefaultSocketReceiveBuffer); |
112 } | 114 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 245 |
244 EXPECT_TRUE(config_.HasReceivedConnectionOptions()); | 246 EXPECT_TRUE(config_.HasReceivedConnectionOptions()); |
245 EXPECT_EQ(1u, config_.ReceivedConnectionOptions().size()); | 247 EXPECT_EQ(1u, config_.ReceivedConnectionOptions().size()); |
246 EXPECT_TRUE( | 248 EXPECT_TRUE( |
247 config_.HasClientSentConnectionOption(kTBBR, Perspective::IS_SERVER)); | 249 config_.HasClientSentConnectionOption(kTBBR, Perspective::IS_SERVER)); |
248 } | 250 } |
249 | 251 |
250 } // namespace | 252 } // namespace |
251 } // namespace test | 253 } // namespace test |
252 } // namespace net | 254 } // namespace net |
OLD | NEW |