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_session.h" | 5 #include "net/quic/quic_session.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 EXPECT_TRUE(session_.IsCryptoHandshakeConfirmed()); | 169 EXPECT_TRUE(session_.IsCryptoHandshakeConfirmed()); |
170 } | 170 } |
171 | 171 |
172 TEST_F(QuicSessionTest, IsClosedStreamDefault) { | 172 TEST_F(QuicSessionTest, IsClosedStreamDefault) { |
173 // Ensure that no streams are initially closed. | 173 // Ensure that no streams are initially closed. |
174 for (int i = kCryptoStreamId; i < 100; i++) { | 174 for (int i = kCryptoStreamId; i < 100; i++) { |
175 EXPECT_FALSE(session_.IsClosedStream(i)); | 175 EXPECT_FALSE(session_.IsClosedStream(i)); |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
| 179 TEST_F(QuicSessionTest, ImplicitlyCreatedStreams) { |
| 180 ASSERT_TRUE(session_.GetIncomingReliableStream(7) != NULL); |
| 181 // Both 3 and 5 should be implicitly created. |
| 182 EXPECT_FALSE(session_.IsClosedStream(3)); |
| 183 EXPECT_FALSE(session_.IsClosedStream(5)); |
| 184 ASSERT_TRUE(session_.GetIncomingReliableStream(5) != NULL); |
| 185 ASSERT_TRUE(session_.GetIncomingReliableStream(3) != NULL); |
| 186 } |
| 187 |
179 TEST_F(QuicSessionTest, IsClosedStreamLocallyCreated) { | 188 TEST_F(QuicSessionTest, IsClosedStreamLocallyCreated) { |
180 TestStream* stream2 = session_.CreateOutgoingReliableStream(); | 189 TestStream* stream2 = session_.CreateOutgoingReliableStream(); |
181 EXPECT_EQ(2u, stream2->id()); | 190 EXPECT_EQ(2u, stream2->id()); |
182 ReliableQuicStreamPeer::SetHeadersDecompressed(stream2, true); | 191 ReliableQuicStreamPeer::SetHeadersDecompressed(stream2, true); |
183 TestStream* stream4 = session_.CreateOutgoingReliableStream(); | 192 TestStream* stream4 = session_.CreateOutgoingReliableStream(); |
184 EXPECT_EQ(4u, stream4->id()); | 193 EXPECT_EQ(4u, stream4->id()); |
185 ReliableQuicStreamPeer::SetHeadersDecompressed(stream4, true); | 194 ReliableQuicStreamPeer::SetHeadersDecompressed(stream4, true); |
186 | 195 |
187 CheckClosedStreams(); | 196 CheckClosedStreams(); |
188 CloseStream(4); | 197 CloseStream(4); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 EXPECT_EQ(1u, session.GetNumOpenStreams()); | 383 EXPECT_EQ(1u, session.GetNumOpenStreams()); |
375 | 384 |
376 connection->CloseConnection(QUIC_CONNECTION_TIMED_OUT, false); | 385 connection->CloseConnection(QUIC_CONNECTION_TIMED_OUT, false); |
377 | 386 |
378 EXPECT_EQ(0u, session.GetNumOpenStreams()); | 387 EXPECT_EQ(0u, session.GetNumOpenStreams()); |
379 } | 388 } |
380 | 389 |
381 } // namespace | 390 } // namespace |
382 } // namespace test | 391 } // namespace test |
383 } // namespace net | 392 } // namespace net |
OLD | NEW |