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 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2561 | 2561 |
2562 TEST_P(QuicConnectionTest, NoQuicCongestionFeedbackFrame) { | 2562 TEST_P(QuicConnectionTest, NoQuicCongestionFeedbackFrame) { |
2563 SendAckPacketToPeer(); | 2563 SendAckPacketToPeer(); |
2564 EXPECT_TRUE(writer_->feedback_frames().empty()); | 2564 EXPECT_TRUE(writer_->feedback_frames().empty()); |
2565 } | 2565 } |
2566 | 2566 |
2567 TEST_P(QuicConnectionTest, WithQuicCongestionFeedbackFrame) { | 2567 TEST_P(QuicConnectionTest, WithQuicCongestionFeedbackFrame) { |
2568 QuicCongestionFeedbackFrame info; | 2568 QuicCongestionFeedbackFrame info; |
2569 info.type = kTCP; | 2569 info.type = kTCP; |
2570 info.tcp.receive_window = 0x4030; | 2570 info.tcp.receive_window = 0x4030; |
2571 SetFeedback(&info); | |
2572 | 2571 |
2573 SendAckPacketToPeer(); | 2572 // After QUIC_VERSION_22, do not send TCP Congestion Feedback Frames anymore. |
2574 ASSERT_FALSE(writer_->feedback_frames().empty()); | 2573 if (version() > QUIC_VERSION_22) { |
2575 ASSERT_EQ(kTCP, writer_->feedback_frames()[0].type); | 2574 SendAckPacketToPeer(); |
| 2575 ASSERT_TRUE(writer_->feedback_frames().empty()); |
| 2576 } else { |
| 2577 // Only SetFeedback in this case because SetFeedback will create a receive |
| 2578 // algorithm which is how the received_packet_manager checks if it should be |
| 2579 // creating TCP Congestion Feedback Frames. |
| 2580 SetFeedback(&info); |
| 2581 SendAckPacketToPeer(); |
| 2582 ASSERT_FALSE(writer_->feedback_frames().empty()); |
| 2583 ASSERT_EQ(kTCP, writer_->feedback_frames()[0].type); |
| 2584 } |
2576 } | 2585 } |
2577 | 2586 |
2578 TEST_P(QuicConnectionTest, UpdateQuicCongestionFeedbackFrame) { | 2587 TEST_P(QuicConnectionTest, UpdateQuicCongestionFeedbackFrame) { |
2579 SendAckPacketToPeer(); | 2588 SendAckPacketToPeer(); |
2580 EXPECT_CALL(*receive_algorithm_, RecordIncomingPacket(_, _, _)); | 2589 EXPECT_CALL(*receive_algorithm_, RecordIncomingPacket(_, _, _)); |
2581 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 2590 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
2582 ProcessPacket(1); | 2591 ProcessPacket(1); |
2583 } | 2592 } |
2584 | 2593 |
2585 TEST_P(QuicConnectionTest, DontUpdateQuicCongestionFeedbackFrameForRevived) { | 2594 TEST_P(QuicConnectionTest, DontUpdateQuicCongestionFeedbackFrameForRevived) { |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3954 QuicBlockedFrame blocked; | 3963 QuicBlockedFrame blocked; |
3955 blocked.stream_id = 3; | 3964 blocked.stream_id = 3; |
3956 EXPECT_CALL(visitor_, OnBlockedFrames(_)); | 3965 EXPECT_CALL(visitor_, OnBlockedFrames(_)); |
3957 ProcessFramePacket(QuicFrame(&blocked)); | 3966 ProcessFramePacket(QuicFrame(&blocked)); |
3958 EXPECT_TRUE(ack_alarm->IsSet()); | 3967 EXPECT_TRUE(ack_alarm->IsSet()); |
3959 } | 3968 } |
3960 | 3969 |
3961 } // namespace | 3970 } // namespace |
3962 } // namespace test | 3971 } // namespace test |
3963 } // namespace net | 3972 } // namespace net |
OLD | NEW |