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 3943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3954 connection_.OnPacketHeader(header); | 3954 connection_.OnPacketHeader(header); |
3955 } | 3955 } |
3956 | 3956 |
3957 TEST_P(QuicConnectionTest, Pacing) { | 3957 TEST_P(QuicConnectionTest, Pacing) { |
3958 ValueRestore<bool> old_flag(&FLAGS_enable_quic_pacing, true); | 3958 ValueRestore<bool> old_flag(&FLAGS_enable_quic_pacing, true); |
3959 | 3959 |
3960 TestConnection server(connection_id_, IPEndPoint(), helper_.get(), | 3960 TestConnection server(connection_id_, IPEndPoint(), helper_.get(), |
3961 writer_.get(), true, version()); | 3961 writer_.get(), true, version()); |
3962 TestConnection client(connection_id_, IPEndPoint(), helper_.get(), | 3962 TestConnection client(connection_id_, IPEndPoint(), helper_.get(), |
3963 writer_.get(), false, version()); | 3963 writer_.get(), false, version()); |
3964 EXPECT_TRUE(client.sent_packet_manager().using_pacing()); | 3964 EXPECT_FALSE(client.sent_packet_manager().using_pacing()); |
3965 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); | 3965 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); |
3966 } | 3966 } |
3967 | 3967 |
3968 TEST_P(QuicConnectionTest, ControlFramesInstigateAcks) { | 3968 TEST_P(QuicConnectionTest, ControlFramesInstigateAcks) { |
3969 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 3969 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
3970 | 3970 |
3971 // Send a WINDOW_UPDATE frame. | 3971 // Send a WINDOW_UPDATE frame. |
3972 QuicWindowUpdateFrame window_update; | 3972 QuicWindowUpdateFrame window_update; |
3973 window_update.stream_id = 3; | 3973 window_update.stream_id = 3; |
3974 window_update.byte_offset = 1234; | 3974 window_update.byte_offset = 1234; |
3975 EXPECT_CALL(visitor_, OnWindowUpdateFrames(_)); | 3975 EXPECT_CALL(visitor_, OnWindowUpdateFrames(_)); |
3976 ProcessFramePacket(QuicFrame(&window_update)); | 3976 ProcessFramePacket(QuicFrame(&window_update)); |
3977 | 3977 |
3978 // Ensure that this has caused the ACK alarm to be set. | 3978 // Ensure that this has caused the ACK alarm to be set. |
3979 QuicAlarm* ack_alarm = QuicConnectionPeer::GetAckAlarm(&connection_); | 3979 QuicAlarm* ack_alarm = QuicConnectionPeer::GetAckAlarm(&connection_); |
3980 EXPECT_TRUE(ack_alarm->IsSet()); | 3980 EXPECT_TRUE(ack_alarm->IsSet()); |
3981 | 3981 |
3982 // Cancel alarm, and try again with BLOCKED frame. | 3982 // Cancel alarm, and try again with BLOCKED frame. |
3983 ack_alarm->Cancel(); | 3983 ack_alarm->Cancel(); |
3984 QuicBlockedFrame blocked; | 3984 QuicBlockedFrame blocked; |
3985 blocked.stream_id = 3; | 3985 blocked.stream_id = 3; |
3986 EXPECT_CALL(visitor_, OnBlockedFrames(_)); | 3986 EXPECT_CALL(visitor_, OnBlockedFrames(_)); |
3987 ProcessFramePacket(QuicFrame(&blocked)); | 3987 ProcessFramePacket(QuicFrame(&blocked)); |
3988 EXPECT_TRUE(ack_alarm->IsSet()); | 3988 EXPECT_TRUE(ack_alarm->IsSet()); |
3989 } | 3989 } |
3990 | 3990 |
3991 } // namespace | 3991 } // namespace |
3992 } // namespace test | 3992 } // namespace test |
3993 } // namespace net | 3993 } // namespace net |
OLD | NEW |