| 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_connection.h" | 5 #include "net/quic/quic_connection.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 clock_.AdvanceTime(DefaultRetransmissionTime()); | 1951 clock_.AdvanceTime(DefaultRetransmissionTime()); |
| 1952 connection_.GetRetransmissionAlarm()->Fire(); | 1952 connection_.GetRetransmissionAlarm()->Fire(); |
| 1953 | 1953 |
| 1954 // Ack the sent packet before the callback returns, which happens in | 1954 // Ack the sent packet before the callback returns, which happens in |
| 1955 // rare circumstances with write blocked sockets. | 1955 // rare circumstances with write blocked sockets. |
| 1956 QuicAckFrame ack = InitAckFrame(1, 0); | 1956 QuicAckFrame ack = InitAckFrame(1, 0); |
| 1957 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); | 1957 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
| 1958 ProcessAckPacket(&ack); | 1958 ProcessAckPacket(&ack); |
| 1959 | 1959 |
| 1960 connection_.OnPacketSent(WriteResult(WRITE_STATUS_OK, 0)); | 1960 connection_.OnPacketSent(WriteResult(WRITE_STATUS_OK, 0)); |
| 1961 // The retransmission alarm should not be set because there are | 1961 // There is now a pending packet, but with no retransmittable frames. |
| 1962 // no unacked packets. | 1962 EXPECT_TRUE(connection_.GetRetransmissionAlarm()->IsSet()); |
| 1963 EXPECT_FALSE(connection_.GetRetransmissionAlarm()->IsSet()); | 1963 EXPECT_FALSE(connection_.sent_packet_manager().HasRetransmittableFrames(2)); |
| 1964 } | 1964 } |
| 1965 | 1965 |
| 1966 TEST_P(QuicConnectionTest, AlarmsWhenWriteBlocked) { | 1966 TEST_P(QuicConnectionTest, AlarmsWhenWriteBlocked) { |
| 1967 // Block the connection. | 1967 // Block the connection. |
| 1968 BlockOnNextWrite(); | 1968 BlockOnNextWrite(); |
| 1969 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, NULL); | 1969 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, NULL); |
| 1970 EXPECT_EQ(1u, writer_->packets_write_attempts()); | 1970 EXPECT_EQ(1u, writer_->packets_write_attempts()); |
| 1971 EXPECT_TRUE(writer_->IsWriteBlocked()); | 1971 EXPECT_TRUE(writer_->IsWriteBlocked()); |
| 1972 | 1972 |
| 1973 // Set the send and resumption alarms. Fire the alarms and ensure they don't | 1973 // Set the send and resumption alarms. Fire the alarms and ensure they don't |
| (...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3981 QuicBlockedFrame blocked; | 3981 QuicBlockedFrame blocked; |
| 3982 blocked.stream_id = 3; | 3982 blocked.stream_id = 3; |
| 3983 EXPECT_CALL(visitor_, OnBlockedFrames(_)); | 3983 EXPECT_CALL(visitor_, OnBlockedFrames(_)); |
| 3984 ProcessFramePacket(QuicFrame(&blocked)); | 3984 ProcessFramePacket(QuicFrame(&blocked)); |
| 3985 EXPECT_TRUE(ack_alarm->IsSet()); | 3985 EXPECT_TRUE(ack_alarm->IsSet()); |
| 3986 } | 3986 } |
| 3987 | 3987 |
| 3988 } // namespace | 3988 } // namespace |
| 3989 } // namespace test | 3989 } // namespace test |
| 3990 } // namespace net | 3990 } // namespace net |
| OLD | NEW |