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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 task_runner_->PostDelayedTask(FROM_HERE, | 56 task_runner_->PostDelayedTask(FROM_HERE, |
57 base::Bind(&CongestionControlTest::AckFrame, | 57 base::Bind(&CongestionControlTest::AckFrame, |
58 base::Unretained(this), | 58 base::Unretained(this), |
59 frame_id_), | 59 frame_id_), |
60 ack_time); | 60 ack_time); |
61 task_runner_->Sleep(frame_delay); | 61 task_runner_->Sleep(frame_delay); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 base::SimpleTestTickClock testing_clock_; | 65 base::SimpleTestTickClock testing_clock_; |
66 scoped_ptr<CongestionControl> congestion_control_; | 66 std::unique_ptr<CongestionControl> congestion_control_; |
67 scoped_refptr<FakeSingleThreadTaskRunner> task_runner_; | 67 scoped_refptr<FakeSingleThreadTaskRunner> task_runner_; |
68 uint32_t frame_id_; | 68 uint32_t frame_id_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(CongestionControlTest); | 70 DISALLOW_COPY_AND_ASSIGN(CongestionControlTest); |
71 }; | 71 }; |
72 | 72 |
73 // Tests that AdaptiveCongestionControl returns reasonable bitrates based on | 73 // Tests that AdaptiveCongestionControl returns reasonable bitrates based on |
74 // estimations of network bandwidth and how much is in-flight (i.e, using the | 74 // estimations of network bandwidth and how much is in-flight (i.e, using the |
75 // "target buffer fill" model). | 75 // "target buffer fill" model). |
76 TEST_F(CongestionControlTest, SimpleRun) { | 76 TEST_F(CongestionControlTest, SimpleRun) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Results should show that we have ~200ms to send. | 137 // Results should show that we have ~200ms to send. |
138 bitrate = congestion_control_->GetBitrate( | 138 bitrate = congestion_control_->GetBitrate( |
139 testing_clock_.NowTicks() + base::TimeDelta::FromMilliseconds(300), | 139 testing_clock_.NowTicks() + base::TimeDelta::FromMilliseconds(300), |
140 base::TimeDelta::FromMilliseconds(300)); | 140 base::TimeDelta::FromMilliseconds(300)); |
141 EXPECT_NEAR(safe_bitrate / kTargetEmptyBufferFraction * 2 / 3, bitrate, | 141 EXPECT_NEAR(safe_bitrate / kTargetEmptyBufferFraction * 2 / 3, bitrate, |
142 safe_bitrate * 0.05); | 142 safe_bitrate * 0.05); |
143 } | 143 } |
144 | 144 |
145 } // namespace cast | 145 } // namespace cast |
146 } // namespace media | 146 } // namespace media |
OLD | NEW |