OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "net/quic/congestion_control/inter_arrival_sender.h" | 8 #include "net/quic/congestion_control/inter_arrival_sender.h" |
9 #include "net/quic/test_tools/mock_clock.h" | 9 #include "net/quic/test_tools/mock_clock.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 nine_ms_(QuicTime::Delta::FromMilliseconds(9)), | 21 nine_ms_(QuicTime::Delta::FromMilliseconds(9)), |
22 send_start_time_(send_clock_.Now()), | 22 send_start_time_(send_clock_.Now()), |
23 sender_(&send_clock_), | 23 sender_(&send_clock_), |
24 sequence_number_(1), | 24 sequence_number_(1), |
25 acked_sequence_number_(1), | 25 acked_sequence_number_(1), |
26 feedback_sequence_number_(1) { | 26 feedback_sequence_number_(1) { |
27 send_clock_.AdvanceTime(one_ms_); | 27 send_clock_.AdvanceTime(one_ms_); |
28 receive_clock_.AdvanceTime(one_ms_); | 28 receive_clock_.AdvanceTime(one_ms_); |
29 } | 29 } |
30 | 30 |
31 ~InterArrivalSenderTest() { | 31 virtual ~InterArrivalSenderTest() { |
32 STLDeleteValues(&sent_packets_); | 32 STLDeleteValues(&sent_packets_); |
33 } | 33 } |
34 | 34 |
35 void SendAvailableCongestionWindow() { | 35 void SendAvailableCongestionWindow() { |
36 while (sender_.TimeUntilSend(send_clock_.Now(), NOT_RETRANSMISSION, | 36 while (sender_.TimeUntilSend(send_clock_.Now(), NOT_RETRANSMISSION, |
37 HAS_RETRANSMITTABLE_DATA).IsZero()) { | 37 HAS_RETRANSMITTABLE_DATA).IsZero()) { |
38 QuicByteCount bytes_in_packet = kMaxPacketSize; | 38 QuicByteCount bytes_in_packet = kMaxPacketSize; |
39 sent_packets_[sequence_number_] = | 39 sent_packets_[sequence_number_] = |
40 new class SendAlgorithmInterface::SentPacket( | 40 new class SendAlgorithmInterface::SentPacket( |
41 bytes_in_packet, send_clock_.Now()); | 41 bytes_in_packet, send_clock_.Now()); |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 acked_sequence_number_ += 2; // Create a loss by not acking both packets. | 556 acked_sequence_number_ += 2; // Create a loss by not acking both packets. |
557 SendFeedbackMessageNPackets(2, nine_ms_, nine_ms_); | 557 SendFeedbackMessageNPackets(2, nine_ms_, nine_ms_); |
558 | 558 |
559 // Make sure our bitrate is fixed at the expected_min_bitrate. | 559 // Make sure our bitrate is fixed at the expected_min_bitrate. |
560 EXPECT_EQ(expected_min_bitrate, sender_.BandwidthEstimate()); | 560 EXPECT_EQ(expected_min_bitrate, sender_.BandwidthEstimate()); |
561 } | 561 } |
562 } | 562 } |
563 | 563 |
564 } // namespace test | 564 } // namespace test |
565 } // namespace net | 565 } // namespace net |
OLD | NEW |