| 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/quic/quic_data_stream.h" | 5 #include "net/quic/quic_data_stream.h" |
| 6 | 6 |
| 7 #include "net/quic/quic_ack_notifier.h" | 7 #include "net/quic/quic_ack_notifier.h" |
| 8 #include "net/quic/quic_connection.h" | 8 #include "net/quic/quic_connection.h" |
| 9 #include "net/quic/quic_flags.h" | 9 #include "net/quic/quic_flags.h" |
| 10 #include "net/quic/quic_utils.h" | 10 #include "net/quic/quic_utils.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 EXPECT_EQ(kWindow, QuicFlowControllerPeer::SendWindowOffset( | 296 EXPECT_EQ(kWindow, QuicFlowControllerPeer::SendWindowOffset( |
| 297 stream_->flow_controller())); | 297 stream_->flow_controller())); |
| 298 | 298 |
| 299 // Try to send more data than the flow control limit allows. | 299 // Try to send more data than the flow control limit allows. |
| 300 string headers = SpdyUtils::SerializeUncompressedHeaders(headers_); | 300 string headers = SpdyUtils::SerializeUncompressedHeaders(headers_); |
| 301 string body; | 301 string body; |
| 302 const uint64 kOverflow = 15; | 302 const uint64 kOverflow = 15; |
| 303 GenerateBody(&body, kWindow + kOverflow); | 303 GenerateBody(&body, kWindow + kOverflow); |
| 304 | 304 |
| 305 EXPECT_CALL(*connection_, SendBlocked(kClientDataStreamId1)); | 305 EXPECT_CALL(*connection_, SendBlocked(kClientDataStreamId1)); |
| 306 EXPECT_CALL(*session_, WritevData(kClientDataStreamId1, _, _, _, _)) | 306 EXPECT_CALL(*session_, WritevData(kClientDataStreamId1, _, _, _, _, _)) |
| 307 .WillOnce(Return(QuicConsumedData(kWindow, true))); | 307 .WillOnce(Return(QuicConsumedData(kWindow, true))); |
| 308 stream_->WriteOrBufferData(body, false, NULL); | 308 stream_->WriteOrBufferData(body, false, NULL); |
| 309 | 309 |
| 310 // Should have sent as much as possible, resulting in no send window left. | 310 // Should have sent as much as possible, resulting in no send window left. |
| 311 EXPECT_EQ(0u, | 311 EXPECT_EQ(0u, |
| 312 QuicFlowControllerPeer::SendWindowSize(stream_->flow_controller())); | 312 QuicFlowControllerPeer::SendWindowSize(stream_->flow_controller())); |
| 313 | 313 |
| 314 // And we should have queued the overflowed data. | 314 // And we should have queued the overflowed data. |
| 315 EXPECT_EQ(kOverflow, | 315 EXPECT_EQ(kOverflow, |
| 316 ReliableQuicStreamPeer::SizeOfQueuedData(stream_.get())); | 316 ReliableQuicStreamPeer::SizeOfQueuedData(stream_.get())); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 // Set a flow control limit of zero. | 553 // Set a flow control limit of zero. |
| 554 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(), 0); | 554 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(), 0); |
| 555 EXPECT_EQ(0u, QuicFlowControllerPeer::ReceiveWindowOffset( | 555 EXPECT_EQ(0u, QuicFlowControllerPeer::ReceiveWindowOffset( |
| 556 stream_->flow_controller())); | 556 stream_->flow_controller())); |
| 557 | 557 |
| 558 // Send a frame with a FIN but no data. This should not be blocked. | 558 // Send a frame with a FIN but no data. This should not be blocked. |
| 559 string body = ""; | 559 string body = ""; |
| 560 bool fin = true; | 560 bool fin = true; |
| 561 | 561 |
| 562 EXPECT_CALL(*connection_, SendBlocked(kClientDataStreamId1)).Times(0); | 562 EXPECT_CALL(*connection_, SendBlocked(kClientDataStreamId1)).Times(0); |
| 563 EXPECT_CALL(*session_, WritevData(kClientDataStreamId1, _, _, _, _)) | 563 EXPECT_CALL(*session_, WritevData(kClientDataStreamId1, _, _, _, _, _)) |
| 564 .WillOnce(Return(QuicConsumedData(0, fin))); | 564 .WillOnce(Return(QuicConsumedData(0, fin))); |
| 565 | 565 |
| 566 stream_->WriteOrBufferData(body, fin, NULL); | 566 stream_->WriteOrBufferData(body, fin, NULL); |
| 567 } | 567 } |
| 568 | 568 |
| 569 } // namespace | 569 } // namespace |
| 570 } // namespace test | 570 } // namespace test |
| 571 } // namespace net | 571 } // namespace net |
| OLD | NEW |