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

Side by Side Diff: net/quic/congestion_control/hybrid_slow_start_test.cc

Issue 822713002: Update from https://crrev.com/309415 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years 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) 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "net/quic/congestion_control/hybrid_slow_start.h" 7 #include "net/quic/congestion_control/hybrid_slow_start.h"
8 #include "net/quic/test_tools/mock_clock.h" 8 #include "net/quic/test_tools/mock_clock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 clock_.AdvanceTime(one_ms_); 77 clock_.AdvanceTime(one_ms_);
78 EXPECT_FALSE(slow_start_->ShouldExitSlowStart(rtt_, rtt_, 100)); 78 EXPECT_FALSE(slow_start_->ShouldExitSlowStart(rtt_, rtt_, 100));
79 } 79 }
80 clock_.AdvanceTime(one_ms_); 80 clock_.AdvanceTime(one_ms_);
81 EXPECT_EQ(ack_train_detection, 81 EXPECT_EQ(ack_train_detection,
82 slow_start_->ShouldExitSlowStart(rtt_, rtt_, 100)); 82 slow_start_->ShouldExitSlowStart(rtt_, rtt_, 100));
83 } 83 }
84 } 84 }
85 85
86 TEST_F(HybridSlowStartTest, Delay) { 86 TEST_F(HybridSlowStartTest, Delay) {
87 // We expect to detect the increase at +1/16 of the RTT; hence at a typical 87 // We expect to detect the increase at +1/8 of the RTT; hence at a typical
88 // RTT of 60ms the detection will happen at 63.75 ms. 88 // RTT of 60ms the detection will happen at 67.5 ms.
89 const int kHybridStartMinSamples = 8; // Number of acks required to trigger. 89 const int kHybridStartMinSamples = 8; // Number of acks required to trigger.
90 90
91 QuicPacketSequenceNumber end_sequence_number = 1; 91 QuicPacketSequenceNumber end_sequence_number = 1;
92 slow_start_->StartReceiveRound(end_sequence_number++); 92 slow_start_->StartReceiveRound(end_sequence_number++);
93 93
94 // Will not trigger since our lowest RTT in our burst is the same as the long 94 // Will not trigger since our lowest RTT in our burst is the same as the long
95 // term RTT provided. 95 // term RTT provided.
96 for (int n = 0; n < kHybridStartMinSamples; ++n) { 96 for (int n = 0; n < kHybridStartMinSamples; ++n) {
97 EXPECT_FALSE(slow_start_->ShouldExitSlowStart( 97 EXPECT_FALSE(slow_start_->ShouldExitSlowStart(
98 rtt_.Add(QuicTime::Delta::FromMilliseconds(n)), rtt_, 100)); 98 rtt_.Add(QuicTime::Delta::FromMilliseconds(n)), rtt_, 100));
99 } 99 }
100 slow_start_->StartReceiveRound(end_sequence_number++); 100 slow_start_->StartReceiveRound(end_sequence_number++);
101 for (int n = 1; n < kHybridStartMinSamples; ++n) { 101 for (int n = 1; n < kHybridStartMinSamples; ++n) {
102 EXPECT_FALSE(slow_start_->ShouldExitSlowStart( 102 EXPECT_FALSE(slow_start_->ShouldExitSlowStart(
103 rtt_.Add(QuicTime::Delta::FromMilliseconds(n + 5)), rtt_, 100)); 103 rtt_.Add(QuicTime::Delta::FromMilliseconds(n + 10)), rtt_, 100));
104 } 104 }
105 // Expect to trigger since all packets in this burst was above the long term 105 // Expect to trigger since all packets in this burst was above the long term
106 // RTT provided. 106 // RTT provided.
107 EXPECT_TRUE(slow_start_->ShouldExitSlowStart( 107 EXPECT_TRUE(slow_start_->ShouldExitSlowStart(
108 rtt_.Add(QuicTime::Delta::FromMilliseconds(5)), rtt_, 100)); 108 rtt_.Add(QuicTime::Delta::FromMilliseconds(10)), rtt_, 100));
109 } 109 }
110 110
111 } // namespace test 111 } // namespace test
112 } // namespace net 112 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698