| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/tools/quic/quic_simple_server_session.h" | 5 #include "net/tools/quic/quic_simple_server_session.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 // Tests that incoming stream creation fails when given stream id is even. | 275 // Tests that incoming stream creation fails when given stream id is even. |
| 276 size_t initial_num_open_stream = session_->GetNumOpenIncomingStreams(); | 276 size_t initial_num_open_stream = session_->GetNumOpenIncomingStreams(); |
| 277 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails( | 277 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails( |
| 278 QUIC_INVALID_STREAM_ID, | 278 QUIC_INVALID_STREAM_ID, |
| 279 "Client created even numbered stream")); | 279 "Client created even numbered stream")); |
| 280 QuicSimpleServerSessionPeer::CreateIncomingDynamicStream(session_.get(), 2); | 280 QuicSimpleServerSessionPeer::CreateIncomingDynamicStream(session_.get(), 2); |
| 281 EXPECT_EQ(initial_num_open_stream, session_->GetNumOpenIncomingStreams()); | 281 EXPECT_EQ(initial_num_open_stream, session_->GetNumOpenIncomingStreams()); |
| 282 } | 282 } |
| 283 | 283 |
| 284 TEST_P(QuicSimpleServerSessionTest, CreateIncomingDynamicStream) { | 284 TEST_P(QuicSimpleServerSessionTest, CreateIncomingDynamicStream) { |
| 285 std::unique_ptr<QuicSpdyStream> stream( | 285 QuicSpdyStream* stream = |
| 286 QuicSimpleServerSessionPeer::CreateIncomingDynamicStream( | 286 QuicSimpleServerSessionPeer::CreateIncomingDynamicStream( |
| 287 session_.get(), kClientDataStreamId1)); | 287 session_.get(), kClientDataStreamId1); |
| 288 EXPECT_NE(nullptr, stream); | 288 EXPECT_NE(nullptr, stream); |
| 289 EXPECT_EQ(kClientDataStreamId1, stream->id()); | 289 EXPECT_EQ(kClientDataStreamId1, stream->id()); |
| 290 } | 290 } |
| 291 | 291 |
| 292 TEST_P(QuicSimpleServerSessionTest, CreateOutgoingDynamicStreamDisconnected) { | 292 TEST_P(QuicSimpleServerSessionTest, CreateOutgoingDynamicStreamDisconnected) { |
| 293 // Tests that outgoing stream creation fails when connection is not connected. | 293 // Tests that outgoing stream creation fails when connection is not connected. |
| 294 size_t initial_num_open_stream = session_->GetNumOpenOutgoingStreams(); | 294 size_t initial_num_open_stream = session_->GetNumOpenOutgoingStreams(); |
| 295 QuicConnectionPeer::CloseConnection(connection_); | 295 QuicConnectionPeer::CloseConnection(connection_); |
| 296 EXPECT_DFATAL(QuicSimpleServerSessionPeer::CreateOutgoingDynamicStream( | 296 EXPECT_DFATAL(QuicSimpleServerSessionPeer::CreateOutgoingDynamicStream( |
| 297 session_.get(), kDefaultPriority), | 297 session_.get(), kDefaultPriority), |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 .WillOnce(Return(QuicConsumedData(kStreamFlowControlWindowSize, false))); | 557 .WillOnce(Return(QuicConsumedData(kStreamFlowControlWindowSize, false))); |
| 558 | 558 |
| 559 EXPECT_CALL(*connection_, SendBlocked(stream_to_open)); | 559 EXPECT_CALL(*connection_, SendBlocked(stream_to_open)); |
| 560 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0); | 560 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0); |
| 561 visitor_->OnRstStream(rst); | 561 visitor_->OnRstStream(rst); |
| 562 } | 562 } |
| 563 | 563 |
| 564 } // namespace | 564 } // namespace |
| 565 } // namespace test | 565 } // namespace test |
| 566 } // namespace net | 566 } // namespace net |
| OLD | NEW |