| 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/tools/quic/quic_client_session.h" | 5 #include "net/tools/quic/quic_client_session.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "net/base/ip_endpoint.h" | 9 #include "net/base/ip_endpoint.h" |
| 10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" | 10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // Initialize crypto before the client session will create a stream. | 88 // Initialize crypto before the client session will create a stream. |
| 89 CompleteCryptoHandshake(); | 89 CompleteCryptoHandshake(); |
| 90 | 90 |
| 91 QuicSpdyClientStream* stream = session_->CreateOutgoingDynamicStream(); | 91 QuicSpdyClientStream* stream = session_->CreateOutgoingDynamicStream(); |
| 92 ASSERT_TRUE(stream); | 92 ASSERT_TRUE(stream); |
| 93 EXPECT_FALSE(session_->CreateOutgoingDynamicStream()); | 93 EXPECT_FALSE(session_->CreateOutgoingDynamicStream()); |
| 94 | 94 |
| 95 // Close the stream, but without having received a FIN or a RST_STREAM | 95 // Close the stream, but without having received a FIN or a RST_STREAM |
| 96 // and check that a new one can not be created. | 96 // and check that a new one can not be created. |
| 97 session_->CloseStream(stream->id()); | 97 session_->CloseStream(stream->id()); |
| 98 if (FLAGS_quic_count_unfinished_as_open_streams) { | 98 EXPECT_EQ(1u, session_->GetNumOpenStreams()); |
| 99 EXPECT_EQ(1u, session_->GetNumOpenStreams()); | 99 |
| 100 } else { | |
| 101 EXPECT_EQ(0u, session_->GetNumOpenStreams()); | |
| 102 } | |
| 103 stream = session_->CreateOutgoingDynamicStream(); | 100 stream = session_->CreateOutgoingDynamicStream(); |
| 104 if (FLAGS_quic_count_unfinished_as_open_streams) { | 101 EXPECT_FALSE(stream); |
| 105 EXPECT_FALSE(stream); | |
| 106 } else { | |
| 107 EXPECT_TRUE(stream); | |
| 108 } | |
| 109 } | 102 } |
| 110 | 103 |
| 111 TEST_P(ToolsQuicClientSessionTest, MaxNumStreamsWithRst) { | 104 TEST_P(ToolsQuicClientSessionTest, MaxNumStreamsWithRst) { |
| 112 EXPECT_CALL(*connection_, SendRstStream(_, _, _)).Times(AnyNumber()); | 105 EXPECT_CALL(*connection_, SendRstStream(_, _, _)).Times(AnyNumber()); |
| 113 | 106 |
| 114 session_->config()->SetMaxStreamsPerConnection(1, 1); | 107 session_->config()->SetMaxStreamsPerConnection(1, 1); |
| 115 | 108 |
| 116 // Initialize crypto before the client session will create a stream. | 109 // Initialize crypto before the client session will create a stream. |
| 117 CompleteCryptoHandshake(); | 110 CompleteCryptoHandshake(); |
| 118 | 111 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 PACKET_6BYTE_PACKET_NUMBER, nullptr)); | 212 PACKET_6BYTE_PACKET_NUMBER, nullptr)); |
| 220 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(_, _)).Times(1); | 213 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(_, _)).Times(1); |
| 221 session_->connection()->ProcessUdpPacket(client_address, server_address, | 214 session_->connection()->ProcessUdpPacket(client_address, server_address, |
| 222 *packet); | 215 *packet); |
| 223 } | 216 } |
| 224 | 217 |
| 225 } // namespace | 218 } // namespace |
| 226 } // namespace test | 219 } // namespace test |
| 227 } // namespace tools | 220 } // namespace tools |
| 228 } // namespace net | 221 } // namespace net |
| OLD | NEW |