OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_sustained_bandwidth_recorder.h" | 5 #include "net/quic/quic_sustained_bandwidth_recorder.h" |
6 | 6 |
7 #include "net/quic/quic_bandwidth.h" | 7 #include "net/quic/quic_bandwidth.h" |
8 #include "net/quic/quic_time.h" | 8 #include "net/quic/quic_time.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // Reset the recorder by passing in a measurement while in recovery. | 54 // Reset the recorder by passing in a measurement while in recovery. |
55 in_recovery = true; | 55 in_recovery = true; |
56 recorder.RecordEstimate(in_recovery, in_slow_start, bandwidth, estimate_time, | 56 recorder.RecordEstimate(in_recovery, in_slow_start, bandwidth, estimate_time, |
57 wall_time, srtt); | 57 wall_time, srtt); |
58 in_recovery = false; | 58 in_recovery = false; |
59 recorder.RecordEstimate(in_recovery, in_slow_start, bandwidth, estimate_time, | 59 recorder.RecordEstimate(in_recovery, in_slow_start, bandwidth, estimate_time, |
60 wall_time, srtt); | 60 wall_time, srtt); |
61 EXPECT_EQ(recorder.BandwidthEstimate(), bandwidth); | 61 EXPECT_EQ(recorder.BandwidthEstimate(), bandwidth); |
62 | 62 |
63 estimate_time = estimate_time.Add(srtt.Multiply(3)); | 63 estimate_time = estimate_time.Add(srtt.Multiply(3)); |
64 const int64 kSeconds = 556677; | 64 const int64_t kSeconds = 556677; |
65 QuicWallTime second_bandwidth_wall_time = | 65 QuicWallTime second_bandwidth_wall_time = |
66 QuicWallTime::FromUNIXSeconds(kSeconds); | 66 QuicWallTime::FromUNIXSeconds(kSeconds); |
67 recorder.RecordEstimate(in_recovery, in_slow_start, second_bandwidth, | 67 recorder.RecordEstimate(in_recovery, in_slow_start, second_bandwidth, |
68 estimate_time, second_bandwidth_wall_time, srtt); | 68 estimate_time, second_bandwidth_wall_time, srtt); |
69 EXPECT_EQ(recorder.BandwidthEstimate(), second_bandwidth); | 69 EXPECT_EQ(recorder.BandwidthEstimate(), second_bandwidth); |
70 EXPECT_EQ(recorder.BandwidthEstimate(), recorder.MaxBandwidthEstimate()); | 70 EXPECT_EQ(recorder.BandwidthEstimate(), recorder.MaxBandwidthEstimate()); |
71 EXPECT_EQ(recorder.MaxBandwidthTimestamp(), kSeconds); | 71 EXPECT_EQ(recorder.MaxBandwidthTimestamp(), kSeconds); |
72 | 72 |
73 // Reset again, this time recording a lower bandwidth than before. | 73 // Reset again, this time recording a lower bandwidth than before. |
74 QuicBandwidth third_bandwidth = | 74 QuicBandwidth third_bandwidth = |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 in_slow_start = false; | 122 in_slow_start = false; |
123 recorder.RecordEstimate(in_recovery, in_slow_start, bandwidth, estimate_time, | 123 recorder.RecordEstimate(in_recovery, in_slow_start, bandwidth, estimate_time, |
124 wall_time, srtt); | 124 wall_time, srtt); |
125 EXPECT_TRUE(recorder.HasEstimate()); | 125 EXPECT_TRUE(recorder.HasEstimate()); |
126 EXPECT_FALSE(recorder.EstimateRecordedDuringSlowStart()); | 126 EXPECT_FALSE(recorder.EstimateRecordedDuringSlowStart()); |
127 } | 127 } |
128 | 128 |
129 } // namespace | 129 } // namespace |
130 } // namespace test | 130 } // namespace test |
131 } // namespace net | 131 } // namespace net |
OLD | NEW |