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 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2632 connection_.GetPingAlarm()->deadline()); | 2632 connection_.GetPingAlarm()->deadline()); |
2633 | 2633 |
2634 // Now recevie and ACK of the previous packet, which will move the | 2634 // Now recevie and ACK of the previous packet, which will move the |
2635 // ping alarm forward. | 2635 // ping alarm forward. |
2636 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5)); | 2636 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5)); |
2637 QuicAckFrame frame = InitAckFrame(1); | 2637 QuicAckFrame frame = InitAckFrame(1); |
2638 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 2638 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
2639 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); | 2639 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); |
2640 ProcessAckPacket(&frame); | 2640 ProcessAckPacket(&frame); |
2641 EXPECT_TRUE(connection_.GetPingAlarm()->IsSet()); | 2641 EXPECT_TRUE(connection_.GetPingAlarm()->IsSet()); |
2642 EXPECT_EQ(clock_.ApproximateNow().Add(QuicTime::Delta::FromSeconds(15)), | 2642 // The ping timer is set slightly less than 15 seconds in the future, because |
| 2643 // of the 1s ping timer alarm granularity. |
| 2644 EXPECT_EQ(clock_.ApproximateNow().Add(QuicTime::Delta::FromSeconds(15)) |
| 2645 .Subtract(QuicTime::Delta::FromMilliseconds(5)), |
2643 connection_.GetPingAlarm()->deadline()); | 2646 connection_.GetPingAlarm()->deadline()); |
2644 | 2647 |
2645 writer_->Reset(); | 2648 writer_->Reset(); |
2646 clock_.AdvanceTime(QuicTime::Delta::FromSeconds(15)); | 2649 clock_.AdvanceTime(QuicTime::Delta::FromSeconds(15)); |
2647 connection_.GetPingAlarm()->Fire(); | 2650 connection_.GetPingAlarm()->Fire(); |
2648 EXPECT_EQ(1u, writer_->frame_count()); | 2651 EXPECT_EQ(1u, writer_->frame_count()); |
2649 if (version() >= QUIC_VERSION_18) { | 2652 if (version() >= QUIC_VERSION_18) { |
2650 ASSERT_EQ(1u, writer_->ping_frames().size()); | 2653 ASSERT_EQ(1u, writer_->ping_frames().size()); |
2651 } else { | 2654 } else { |
2652 ASSERT_EQ(1u, writer_->stream_frames().size()); | 2655 ASSERT_EQ(1u, writer_->stream_frames().size()); |
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3984 QuicBlockedFrame blocked; | 3987 QuicBlockedFrame blocked; |
3985 blocked.stream_id = 3; | 3988 blocked.stream_id = 3; |
3986 EXPECT_CALL(visitor_, OnBlockedFrames(_)); | 3989 EXPECT_CALL(visitor_, OnBlockedFrames(_)); |
3987 ProcessFramePacket(QuicFrame(&blocked)); | 3990 ProcessFramePacket(QuicFrame(&blocked)); |
3988 EXPECT_TRUE(ack_alarm->IsSet()); | 3991 EXPECT_TRUE(ack_alarm->IsSet()); |
3989 } | 3992 } |
3990 | 3993 |
3991 } // namespace | 3994 } // namespace |
3992 } // namespace test | 3995 } // namespace test |
3993 } // namespace net | 3996 } // namespace net |
OLD | NEW |