| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 // Regression test for b/14677858. | 734 // Regression test for b/14677858. |
| 735 // Test that the resume write alarm is not set in QuicConnection::OnCanWrite | 735 // Test that the resume write alarm is not set in QuicConnection::OnCanWrite |
| 736 // if currently connection level flow control blocked. If set, this results in | 736 // if currently connection level flow control blocked. If set, this results in |
| 737 // an infinite loop in the EpollServer, as the alarm fires and is immediately | 737 // an infinite loop in the EpollServer, as the alarm fires and is immediately |
| 738 // rescheduled. | 738 // rescheduled. |
| 739 ASSERT_TRUE(Initialize()); | 739 ASSERT_TRUE(Initialize()); |
| 740 client_->client()->WaitForCryptoHandshakeConfirmed(); | 740 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 741 | 741 |
| 742 // Ensure both stream and connection level are flow control blocked by setting | 742 // Ensure both stream and connection level are flow control blocked by setting |
| 743 // the send window offset to 0. | 743 // the send window offset to 0. |
| 744 const uint64 kFlowControlWindow = | 744 const uint64 flow_control_window = |
| 745 server_config_.GetInitialStreamFlowControlWindowToSend(); | 745 server_config_.GetInitialStreamFlowControlWindowToSend(); |
| 746 QuicSpdyClientStream* stream = client_->GetOrCreateStream(); | 746 QuicSpdyClientStream* stream = client_->GetOrCreateStream(); |
| 747 QuicSession* session = client_->client()->session(); | 747 QuicSession* session = client_->client()->session(); |
| 748 QuicFlowControllerPeer::SetSendWindowOffset(stream->flow_controller(), 0); | 748 QuicFlowControllerPeer::SetSendWindowOffset(stream->flow_controller(), 0); |
| 749 QuicFlowControllerPeer::SetSendWindowOffset(session->flow_controller(), 0); | 749 QuicFlowControllerPeer::SetSendWindowOffset(session->flow_controller(), 0); |
| 750 EXPECT_TRUE(stream->flow_controller()->IsBlocked()); | 750 EXPECT_TRUE(stream->flow_controller()->IsBlocked()); |
| 751 EXPECT_TRUE(session->flow_controller()->IsBlocked()); | 751 EXPECT_TRUE(session->flow_controller()->IsBlocked()); |
| 752 | 752 |
| 753 // Make sure that the stream has data pending so that it will be marked as | 753 // Make sure that the stream has data pending so that it will be marked as |
| 754 // write blocked when it receives a stream level WINDOW_UPDATE. | 754 // write blocked when it receives a stream level WINDOW_UPDATE. |
| 755 stream->SendBody("hello", false); | 755 stream->SendBody("hello", false); |
| 756 | 756 |
| 757 // The stream now attempts to write, fails because it is still connection | 757 // The stream now attempts to write, fails because it is still connection |
| 758 // level flow control blocked, and is added to the write blocked list. | 758 // level flow control blocked, and is added to the write blocked list. |
| 759 QuicWindowUpdateFrame window_update(stream->id(), 2 * kFlowControlWindow); | 759 QuicWindowUpdateFrame window_update(stream->id(), 2 * flow_control_window); |
| 760 stream->OnWindowUpdateFrame(window_update); | 760 stream->OnWindowUpdateFrame(window_update); |
| 761 | 761 |
| 762 // Prior to fixing b/14677858 this call would result in an infinite loop in | 762 // Prior to fixing b/14677858 this call would result in an infinite loop in |
| 763 // Chromium. As a proxy for detecting this, we now check whether the | 763 // Chromium. As a proxy for detecting this, we now check whether the |
| 764 // resume_writes_alarm is set after OnCanWrite. It should not be, as the | 764 // resume_writes_alarm is set after OnCanWrite. It should not be, as the |
| 765 // connection is still flow control blocked. | 765 // connection is still flow control blocked. |
| 766 session->connection()->OnCanWrite(); | 766 session->connection()->OnCanWrite(); |
| 767 | 767 |
| 768 QuicAlarm* resume_writes_alarm = | 768 QuicAlarm* resume_writes_alarm = |
| 769 QuicConnectionPeer::GetResumeWritesAlarm(session->connection()); | 769 QuicConnectionPeer::GetResumeWritesAlarm(session->connection()); |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); | 1481 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); |
| 1482 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); | 1482 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
| 1483 | 1483 |
| 1484 client_->client()->session()->connection()->set_debug_visitor(nullptr); | 1484 client_->client()->session()->connection()->set_debug_visitor(nullptr); |
| 1485 } | 1485 } |
| 1486 | 1486 |
| 1487 } // namespace | 1487 } // namespace |
| 1488 } // namespace test | 1488 } // namespace test |
| 1489 } // namespace tools | 1489 } // namespace tools |
| 1490 } // namespace net | 1490 } // namespace net |
| OLD | NEW |