OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_chromium_client_session.h" | 5 #include "net/quic/quic_chromium_client_session.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 148 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
149 scoped_ptr<QuicEncryptedPacket> client_rst(maker_.MakeRstPacket( | 149 scoped_ptr<QuicEncryptedPacket> client_rst(maker_.MakeRstPacket( |
150 1, true, kClientDataStreamId1, QUIC_RST_ACKNOWLEDGEMENT)); | 150 1, true, kClientDataStreamId1, QUIC_RST_ACKNOWLEDGEMENT)); |
151 MockWrite writes[] = { | 151 MockWrite writes[] = { |
152 MockWrite(ASYNC, client_rst->data(), client_rst->length(), 1)}; | 152 MockWrite(ASYNC, client_rst->data(), client_rst->length(), 1)}; |
153 socket_data_.reset(new SequencedSocketData(reads, arraysize(reads), writes, | 153 socket_data_.reset(new SequencedSocketData(reads, arraysize(reads), writes, |
154 arraysize(writes))); | 154 arraysize(writes))); |
155 | 155 |
156 Initialize(); | 156 Initialize(); |
157 CompleteCryptoHandshake(); | 157 CompleteCryptoHandshake(); |
158 const size_t kMaxOpenStreams = session_->get_max_open_streams(); | 158 const size_t kMaxOpenStreams = session_->max_open_outgoing_streams(); |
159 | 159 |
160 std::vector<QuicChromiumClientStream*> streams; | 160 std::vector<QuicChromiumClientStream*> streams; |
161 for (size_t i = 0; i < kMaxOpenStreams; i++) { | 161 for (size_t i = 0; i < kMaxOpenStreams; i++) { |
162 QuicChromiumClientStream* stream = | 162 QuicChromiumClientStream* stream = |
163 session_->CreateOutgoingDynamicStream(kDefaultPriority); | 163 session_->CreateOutgoingDynamicStream(kDefaultPriority); |
164 EXPECT_TRUE(stream); | 164 EXPECT_TRUE(stream); |
165 streams.push_back(stream); | 165 streams.push_back(stream); |
166 } | 166 } |
167 EXPECT_FALSE(session_->CreateOutgoingDynamicStream(kDefaultPriority)); | 167 EXPECT_FALSE(session_->CreateOutgoingDynamicStream(kDefaultPriority)); |
168 | 168 |
(...skipping 14 matching lines...) Expand all Loading... |
183 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 183 MockRead reads[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
184 scoped_ptr<QuicEncryptedPacket> client_rst(maker_.MakeRstPacket( | 184 scoped_ptr<QuicEncryptedPacket> client_rst(maker_.MakeRstPacket( |
185 1, true, kClientDataStreamId1, QUIC_RST_ACKNOWLEDGEMENT)); | 185 1, true, kClientDataStreamId1, QUIC_RST_ACKNOWLEDGEMENT)); |
186 MockWrite writes[] = { | 186 MockWrite writes[] = { |
187 MockWrite(ASYNC, client_rst->data(), client_rst->length(), 1)}; | 187 MockWrite(ASYNC, client_rst->data(), client_rst->length(), 1)}; |
188 socket_data_.reset(new SequencedSocketData(reads, arraysize(reads), writes, | 188 socket_data_.reset(new SequencedSocketData(reads, arraysize(reads), writes, |
189 arraysize(writes))); | 189 arraysize(writes))); |
190 | 190 |
191 Initialize(); | 191 Initialize(); |
192 CompleteCryptoHandshake(); | 192 CompleteCryptoHandshake(); |
193 const size_t kMaxOpenStreams = session_->get_max_open_streams(); | 193 const size_t kMaxOpenStreams = session_->max_open_outgoing_streams(); |
194 | 194 |
195 std::vector<QuicChromiumClientStream*> streams; | 195 std::vector<QuicChromiumClientStream*> streams; |
196 for (size_t i = 0; i < kMaxOpenStreams; i++) { | 196 for (size_t i = 0; i < kMaxOpenStreams; i++) { |
197 QuicChromiumClientStream* stream = | 197 QuicChromiumClientStream* stream = |
198 session_->CreateOutgoingDynamicStream(kDefaultPriority); | 198 session_->CreateOutgoingDynamicStream(kDefaultPriority); |
199 EXPECT_TRUE(stream); | 199 EXPECT_TRUE(stream); |
200 streams.push_back(stream); | 200 streams.push_back(stream); |
201 } | 201 } |
202 | 202 |
203 QuicChromiumClientStream* stream; | 203 QuicChromiumClientStream* stream; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 session_->connection()->SendPing(); | 519 session_->connection()->SendPing(); |
520 EXPECT_FALSE(session_->connection()->connected()); | 520 EXPECT_FALSE(session_->connection()->connected()); |
521 | 521 |
522 EXPECT_TRUE(socket_data.AllReadDataConsumed()); | 522 EXPECT_TRUE(socket_data.AllReadDataConsumed()); |
523 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); | 523 EXPECT_TRUE(socket_data.AllWriteDataConsumed()); |
524 } | 524 } |
525 | 525 |
526 } // namespace | 526 } // namespace |
527 } // namespace test | 527 } // namespace test |
528 } // namespace net | 528 } // namespace net |
OLD | NEW |