| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
| 9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
| 10 #include "net/base/net_log_unittest.h" | 10 #include "net/base/net_log_unittest.h" |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 data.RunFor(2); | 472 data.RunFor(2); |
| 473 | 473 |
| 474 EXPECT_FALSE(stream->send_stalled_by_flow_control()); | 474 EXPECT_FALSE(stream->send_stalled_by_flow_control()); |
| 475 | 475 |
| 476 // Reduce the send window size to 0 to stall. | 476 // Reduce the send window size to 0 to stall. |
| 477 while (stream->send_window_size() > 0) { | 477 while (stream->send_window_size() > 0) { |
| 478 stream->DecreaseSendWindowSize( | 478 stream->DecreaseSendWindowSize( |
| 479 std::min(kMaxSpdyFrameChunkSize, stream->send_window_size())); | 479 std::min(kMaxSpdyFrameChunkSize, stream->send_window_size())); |
| 480 } | 480 } |
| 481 | 481 |
| 482 EXPECT_EQ(ERR_IO_PENDING, delegate.OnSendBody()); | 482 delegate.OnSendBody(); |
| 483 | 483 |
| 484 EXPECT_TRUE(stream->send_stalled_by_flow_control()); | 484 EXPECT_TRUE(stream->send_stalled_by_flow_control()); |
| 485 | 485 |
| 486 stream->IncreaseSendWindowSize(kPostBodyLength); | 486 stream->IncreaseSendWindowSize(kPostBodyLength); |
| 487 | 487 |
| 488 EXPECT_FALSE(stream->send_stalled_by_flow_control()); | 488 EXPECT_FALSE(stream->send_stalled_by_flow_control()); |
| 489 | 489 |
| 490 data.RunFor(3); | 490 data.RunFor(3); |
| 491 | 491 |
| 492 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate.WaitForClose()); | 492 EXPECT_EQ(ERR_CONNECTION_CLOSED, delegate.WaitForClose()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 data.RunFor(2); | 556 data.RunFor(2); |
| 557 | 557 |
| 558 EXPECT_FALSE(stream->send_stalled_by_flow_control()); | 558 EXPECT_FALSE(stream->send_stalled_by_flow_control()); |
| 559 | 559 |
| 560 // Reduce the send window size to 0 to stall. | 560 // Reduce the send window size to 0 to stall. |
| 561 while (stream->send_window_size() > 0) { | 561 while (stream->send_window_size() > 0) { |
| 562 stream->DecreaseSendWindowSize( | 562 stream->DecreaseSendWindowSize( |
| 563 std::min(kMaxSpdyFrameChunkSize, stream->send_window_size())); | 563 std::min(kMaxSpdyFrameChunkSize, stream->send_window_size())); |
| 564 } | 564 } |
| 565 | 565 |
| 566 EXPECT_EQ(ERR_IO_PENDING, delegate.OnSendBody()); | 566 delegate.OnSendBody(); |
| 567 | 567 |
| 568 EXPECT_TRUE(stream->send_stalled_by_flow_control()); | 568 EXPECT_TRUE(stream->send_stalled_by_flow_control()); |
| 569 | 569 |
| 570 stream->AdjustSendWindowSize(-static_cast<int>(kPostBodyLength)); | 570 stream->AdjustSendWindowSize(-static_cast<int>(kPostBodyLength)); |
| 571 | 571 |
| 572 EXPECT_TRUE(stream->send_stalled_by_flow_control()); | 572 EXPECT_TRUE(stream->send_stalled_by_flow_control()); |
| 573 | 573 |
| 574 stream->AdjustSendWindowSize(kPostBodyLength); | 574 stream->AdjustSendWindowSize(kPostBodyLength); |
| 575 | 575 |
| 576 EXPECT_TRUE(stream->send_stalled_by_flow_control()); | 576 EXPECT_TRUE(stream->send_stalled_by_flow_control()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 589 EXPECT_EQ(std::string(kPostBody, kPostBodyLength), | 589 EXPECT_EQ(std::string(kPostBody, kPostBodyLength), |
| 590 delegate.TakeReceivedData()); | 590 delegate.TakeReceivedData()); |
| 591 EXPECT_EQ(static_cast<int>(kPostBodyLength), delegate.body_data_sent()); | 591 EXPECT_EQ(static_cast<int>(kPostBodyLength), delegate.body_data_sent()); |
| 592 } | 592 } |
| 593 | 593 |
| 594 } // namespace | 594 } // namespace |
| 595 | 595 |
| 596 } // namespace test | 596 } // namespace test |
| 597 | 597 |
| 598 } // namespace net | 598 } // namespace net |
| OLD | NEW |