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 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3004 | 3004 |
3005 QuicGoAwayFrame goaway; | 3005 QuicGoAwayFrame goaway; |
3006 goaway.last_good_stream_id = 1; | 3006 goaway.last_good_stream_id = 1; |
3007 goaway.error_code = QUIC_PEER_GOING_AWAY; | 3007 goaway.error_code = QUIC_PEER_GOING_AWAY; |
3008 goaway.reason_phrase = "Going away."; | 3008 goaway.reason_phrase = "Going away."; |
3009 EXPECT_CALL(visitor_, OnGoAway(_)); | 3009 EXPECT_CALL(visitor_, OnGoAway(_)); |
3010 ProcessGoAwayPacket(&goaway); | 3010 ProcessGoAwayPacket(&goaway); |
3011 } | 3011 } |
3012 | 3012 |
3013 TEST_P(QuicConnectionTest, WindowUpdate) { | 3013 TEST_P(QuicConnectionTest, WindowUpdate) { |
3014 if (version() < QUIC_VERSION_14) { | 3014 if (version() == QUIC_VERSION_13) { |
3015 return; | 3015 return; |
3016 } | 3016 } |
3017 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 3017 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
3018 | 3018 |
3019 QuicWindowUpdateFrame window_update; | 3019 QuicWindowUpdateFrame window_update; |
3020 window_update.stream_id = 3; | 3020 window_update.stream_id = 3; |
3021 window_update.byte_offset = 1234; | 3021 window_update.byte_offset = 1234; |
3022 EXPECT_CALL(visitor_, OnWindowUpdateFrames(_)); | 3022 EXPECT_CALL(visitor_, OnWindowUpdateFrames(_)); |
3023 ProcessFramePacket(QuicFrame(&window_update)); | 3023 ProcessFramePacket(QuicFrame(&window_update)); |
3024 } | 3024 } |
3025 | 3025 |
3026 TEST_P(QuicConnectionTest, Blocked) { | 3026 TEST_P(QuicConnectionTest, Blocked) { |
3027 if (version() < QUIC_VERSION_14) { | 3027 if (version() == QUIC_VERSION_13) { |
3028 return; | 3028 return; |
3029 } | 3029 } |
3030 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 3030 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
3031 | 3031 |
3032 QuicBlockedFrame blocked; | 3032 QuicBlockedFrame blocked; |
3033 blocked.stream_id = 3; | 3033 blocked.stream_id = 3; |
3034 EXPECT_CALL(visitor_, OnBlockedFrames(_)); | 3034 EXPECT_CALL(visitor_, OnBlockedFrames(_)); |
3035 ProcessFramePacket(QuicFrame(&blocked)); | 3035 ProcessFramePacket(QuicFrame(&blocked)); |
3036 } | 3036 } |
3037 | 3037 |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3797 | 3797 |
3798 TestConnection server(connection_id_, IPEndPoint(), helper_.get(), | 3798 TestConnection server(connection_id_, IPEndPoint(), helper_.get(), |
3799 writer_.get(), true, version()); | 3799 writer_.get(), true, version()); |
3800 TestConnection client(connection_id_, IPEndPoint(), helper_.get(), | 3800 TestConnection client(connection_id_, IPEndPoint(), helper_.get(), |
3801 writer_.get(), false, version()); | 3801 writer_.get(), false, version()); |
3802 EXPECT_TRUE(client.sent_packet_manager().using_pacing()); | 3802 EXPECT_TRUE(client.sent_packet_manager().using_pacing()); |
3803 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); | 3803 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); |
3804 } | 3804 } |
3805 | 3805 |
3806 TEST_P(QuicConnectionTest, ControlFramesInstigateAcks) { | 3806 TEST_P(QuicConnectionTest, ControlFramesInstigateAcks) { |
3807 if (version() < QUIC_VERSION_14) { | 3807 if (version() == QUIC_VERSION_13) { |
3808 return; | 3808 return; |
3809 } | 3809 } |
3810 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 3810 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
3811 | 3811 |
3812 // Send a WINDOW_UPDATE frame. | 3812 // Send a WINDOW_UPDATE frame. |
3813 QuicWindowUpdateFrame window_update; | 3813 QuicWindowUpdateFrame window_update; |
3814 window_update.stream_id = 3; | 3814 window_update.stream_id = 3; |
3815 window_update.byte_offset = 1234; | 3815 window_update.byte_offset = 1234; |
3816 EXPECT_CALL(visitor_, OnWindowUpdateFrames(_)); | 3816 EXPECT_CALL(visitor_, OnWindowUpdateFrames(_)); |
3817 ProcessFramePacket(QuicFrame(&window_update)); | 3817 ProcessFramePacket(QuicFrame(&window_update)); |
3818 | 3818 |
3819 // Ensure that this has caused the ACK alarm to be set. | 3819 // Ensure that this has caused the ACK alarm to be set. |
3820 QuicAlarm* ack_alarm = QuicConnectionPeer::GetAckAlarm(&connection_); | 3820 QuicAlarm* ack_alarm = QuicConnectionPeer::GetAckAlarm(&connection_); |
3821 EXPECT_TRUE(ack_alarm->IsSet()); | 3821 EXPECT_TRUE(ack_alarm->IsSet()); |
3822 | 3822 |
3823 // Cancel alarm, and try again with BLOCKED frame. | 3823 // Cancel alarm, and try again with BLOCKED frame. |
3824 ack_alarm->Cancel(); | 3824 ack_alarm->Cancel(); |
3825 QuicBlockedFrame blocked; | 3825 QuicBlockedFrame blocked; |
3826 blocked.stream_id = 3; | 3826 blocked.stream_id = 3; |
3827 EXPECT_CALL(visitor_, OnBlockedFrames(_)); | 3827 EXPECT_CALL(visitor_, OnBlockedFrames(_)); |
3828 ProcessFramePacket(QuicFrame(&blocked)); | 3828 ProcessFramePacket(QuicFrame(&blocked)); |
3829 EXPECT_TRUE(ack_alarm->IsSet()); | 3829 EXPECT_TRUE(ack_alarm->IsSet()); |
3830 } | 3830 } |
3831 | 3831 |
3832 } // namespace | 3832 } // namespace |
3833 } // namespace test | 3833 } // namespace test |
3834 } // namespace net | 3834 } // namespace net |
OLD | NEW |