| 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 2640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2651 | 2651 |
| 2652 TEST_P(QuicConnectionTest, InitialTimeout) { | 2652 TEST_P(QuicConnectionTest, InitialTimeout) { |
| 2653 EXPECT_TRUE(connection_.connected()); | 2653 EXPECT_TRUE(connection_.connected()); |
| 2654 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_CONNECTION_TIMED_OUT, false)); | 2654 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_CONNECTION_TIMED_OUT, false)); |
| 2655 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AnyNumber()); | 2655 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(AnyNumber()); |
| 2656 | 2656 |
| 2657 QuicTime default_timeout = clock_.ApproximateNow().Add( | 2657 QuicTime default_timeout = clock_.ApproximateNow().Add( |
| 2658 QuicTime::Delta::FromSeconds(kDefaultInitialTimeoutSecs)); | 2658 QuicTime::Delta::FromSeconds(kDefaultInitialTimeoutSecs)); |
| 2659 EXPECT_EQ(default_timeout, connection_.GetTimeoutAlarm()->deadline()); | 2659 EXPECT_EQ(default_timeout, connection_.GetTimeoutAlarm()->deadline()); |
| 2660 | 2660 |
| 2661 if (FLAGS_quic_timeouts_require_activity) { | |
| 2662 // Simulate the timeout alarm firing. | |
| 2663 clock_.AdvanceTime( | |
| 2664 QuicTime::Delta::FromSeconds(kDefaultInitialTimeoutSecs)); | |
| 2665 connection_.GetTimeoutAlarm()->Fire(); | |
| 2666 // We should not actually timeout until a packet is sent. | |
| 2667 EXPECT_TRUE(connection_.connected()); | |
| 2668 SendStreamDataToPeer(1, "GET /", 0, kFin, NULL); | |
| 2669 } | |
| 2670 | |
| 2671 // Simulate the timeout alarm firing. | 2661 // Simulate the timeout alarm firing. |
| 2672 clock_.AdvanceTime( | 2662 clock_.AdvanceTime( |
| 2673 QuicTime::Delta::FromSeconds(kDefaultInitialTimeoutSecs)); | 2663 QuicTime::Delta::FromSeconds(kDefaultInitialTimeoutSecs)); |
| 2674 connection_.GetTimeoutAlarm()->Fire(); | 2664 connection_.GetTimeoutAlarm()->Fire(); |
| 2675 | 2665 |
| 2676 EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet()); | 2666 EXPECT_FALSE(connection_.GetTimeoutAlarm()->IsSet()); |
| 2677 EXPECT_FALSE(connection_.connected()); | 2667 EXPECT_FALSE(connection_.connected()); |
| 2678 | 2668 |
| 2679 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); | 2669 EXPECT_FALSE(connection_.GetAckAlarm()->IsSet()); |
| 2680 EXPECT_FALSE(connection_.GetPingAlarm()->IsSet()); | 2670 EXPECT_FALSE(connection_.GetPingAlarm()->IsSet()); |
| (...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3942 QuicBlockedFrame blocked; | 3932 QuicBlockedFrame blocked; |
| 3943 blocked.stream_id = 3; | 3933 blocked.stream_id = 3; |
| 3944 EXPECT_CALL(visitor_, OnBlockedFrames(_)); | 3934 EXPECT_CALL(visitor_, OnBlockedFrames(_)); |
| 3945 ProcessFramePacket(QuicFrame(&blocked)); | 3935 ProcessFramePacket(QuicFrame(&blocked)); |
| 3946 EXPECT_TRUE(ack_alarm->IsSet()); | 3936 EXPECT_TRUE(ack_alarm->IsSet()); |
| 3947 } | 3937 } |
| 3948 | 3938 |
| 3949 } // namespace | 3939 } // namespace |
| 3950 } // namespace test | 3940 } // namespace test |
| 3951 } // namespace net | 3941 } // namespace net |
| OLD | NEW |