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 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1840 clock_.AdvanceTime(DefaultRetransmissionTime()); | 1840 clock_.AdvanceTime(DefaultRetransmissionTime()); |
1841 connection_.GetRetransmissionAlarm()->Fire(); | 1841 connection_.GetRetransmissionAlarm()->Fire(); |
1842 | 1842 |
1843 // Ack the sent packet before the callback returns, which happens in | 1843 // Ack the sent packet before the callback returns, which happens in |
1844 // rare circumstances with write blocked sockets. | 1844 // rare circumstances with write blocked sockets. |
1845 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | 1845 EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); |
1846 QuicAckFrame ack = InitAckFrame(1, 0); | 1846 QuicAckFrame ack = InitAckFrame(1, 0); |
1847 ProcessAckPacket(&ack); | 1847 ProcessAckPacket(&ack); |
1848 | 1848 |
1849 connection_.OnPacketSent(WriteResult(WRITE_STATUS_OK, 0)); | 1849 connection_.OnPacketSent(WriteResult(WRITE_STATUS_OK, 0)); |
1850 EXPECT_TRUE(connection_.GetRetransmissionAlarm()->IsSet()); | 1850 // The retransmission alarm should not be set because there are |
| 1851 // no unacked packets. |
| 1852 EXPECT_FALSE(connection_.GetRetransmissionAlarm()->IsSet()); |
1851 } | 1853 } |
1852 | 1854 |
1853 TEST_F(QuicConnectionTest, ResumptionAlarmWhenWriteBlocked) { | 1855 TEST_F(QuicConnectionTest, ResumptionAlarmWhenWriteBlocked) { |
1854 // Block the connection. | 1856 // Block the connection. |
1855 BlockOnNextWrite(); | 1857 BlockOnNextWrite(); |
1856 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, NULL); | 1858 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, NULL); |
1857 EXPECT_EQ(1u, writer_->packets_write_attempts()); | 1859 EXPECT_EQ(1u, writer_->packets_write_attempts()); |
1858 EXPECT_TRUE(writer_->IsWriteBlocked()); | 1860 EXPECT_TRUE(writer_->IsWriteBlocked()); |
1859 | 1861 |
1860 // Set the send and resumption alarms. Fire the alarms and ensure they don't | 1862 // Set the send and resumption alarms. Fire the alarms and ensure they don't |
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3465 true); | 3467 true); |
3466 TestConnection client(guid_, IPEndPoint(), helper_.get(), writer_.get(), | 3468 TestConnection client(guid_, IPEndPoint(), helper_.get(), writer_.get(), |
3467 false); | 3469 false); |
3468 EXPECT_TRUE(client.sent_packet_manager().using_pacing()); | 3470 EXPECT_TRUE(client.sent_packet_manager().using_pacing()); |
3469 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); | 3471 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); |
3470 } | 3472 } |
3471 | 3473 |
3472 } // namespace | 3474 } // namespace |
3473 } // namespace test | 3475 } // namespace test |
3474 } // namespace net | 3476 } // namespace net |
OLD | NEW |