Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: net/quic/core/congestion_control/pacing_sender_test.cc

Issue 2611613003: Add quic_logging (Closed)
Patch Set: fix failed test? Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "net/quic/core/congestion_control/pacing_sender.h" 5 #include "net/quic/core/congestion_control/pacing_sender.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h"
10 #include "net/quic/core/quic_packets.h" 9 #include "net/quic/core/quic_packets.h"
10 #include "net/quic/platform/api/quic_logging.h"
11 #include "net/quic/test_tools/mock_clock.h" 11 #include "net/quic/test_tools/mock_clock.h"
12 #include "net/quic/test_tools/quic_test_utils.h" 12 #include "net/quic/test_tools/quic_test_utils.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 using testing::Return; 15 using testing::Return;
16 using testing::StrictMock; 16 using testing::StrictMock;
17 using testing::_; 17 using testing::_;
18 18
19 namespace net { 19 namespace net {
20 namespace test { 20 namespace test {
(...skipping 22 matching lines...) Expand all
43 pacing_sender_->set_sender(mock_sender_.get()); 43 pacing_sender_->set_sender(mock_sender_.get());
44 EXPECT_CALL(*mock_sender_, PacingRate(_)).WillRepeatedly(Return(bandwidth)); 44 EXPECT_CALL(*mock_sender_, PacingRate(_)).WillRepeatedly(Return(bandwidth));
45 if (burst_size == 0) { 45 if (burst_size == 0) {
46 EXPECT_CALL(*mock_sender_, OnCongestionEvent(_, _, _, _, _)); 46 EXPECT_CALL(*mock_sender_, OnCongestionEvent(_, _, _, _, _));
47 SendAlgorithmInterface::CongestionVector lost_packets; 47 SendAlgorithmInterface::CongestionVector lost_packets;
48 lost_packets.push_back(std::make_pair(1, kMaxPacketSize)); 48 lost_packets.push_back(std::make_pair(1, kMaxPacketSize));
49 SendAlgorithmInterface::CongestionVector empty; 49 SendAlgorithmInterface::CongestionVector empty;
50 pacing_sender_->OnCongestionEvent(true, 1234, clock_.Now(), empty, 50 pacing_sender_->OnCongestionEvent(true, 1234, clock_.Now(), empty,
51 lost_packets); 51 lost_packets);
52 } else if (burst_size != kInitialBurstPackets) { 52 } else if (burst_size != kInitialBurstPackets) {
53 LOG(FATAL) << "Unsupported burst_size " << burst_size 53 QUIC_LOG(FATAL) << "Unsupported burst_size " << burst_size
54 << " specificied, only 0 and " << kInitialBurstPackets 54 << " specificied, only 0 and " << kInitialBurstPackets
55 << " are supported."; 55 << " are supported.";
56 } 56 }
57 } 57 }
58 58
59 void CheckPacketIsSentImmediately(HasRetransmittableData retransmittable_data, 59 void CheckPacketIsSentImmediately(HasRetransmittableData retransmittable_data,
60 QuicByteCount bytes_in_flight, 60 QuicByteCount bytes_in_flight,
61 bool in_recovery) { 61 bool in_recovery) {
62 // In order for the packet to be sendable, the underlying sender must 62 // In order for the packet to be sendable, the underlying sender must
63 // permit it to be sent immediately. 63 // permit it to be sent immediately.
64 for (int i = 0; i < 2; ++i) { 64 for (int i = 0; i < 2; ++i) {
65 EXPECT_CALL(*mock_sender_, TimeUntilSend(clock_.Now(), bytes_in_flight)) 65 EXPECT_CALL(*mock_sender_, TimeUntilSend(clock_.Now(), bytes_in_flight))
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 UpdateRtt(); 343 UpdateRtt();
344 344
345 // Ensure only one packet is sent immediately and the rest are paced. 345 // Ensure only one packet is sent immediately and the rest are paced.
346 CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0, true); 346 CheckPacketIsSentImmediately(HAS_RETRANSMITTABLE_DATA, 0, true);
347 CheckPacketIsSentImmediately(); 347 CheckPacketIsSentImmediately();
348 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2)); 348 CheckPacketIsDelayed(QuicTime::Delta::FromMilliseconds(2));
349 } 349 }
350 350
351 } // namespace test 351 } // namespace test
352 } // namespace net 352 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/congestion_control/pacing_sender.cc ('k') | net/quic/core/congestion_control/prr_sender_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698