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

Side by Side Diff: webrtc/call/bitrate_allocator_unittest.cc

Issue 1972183004: Reland "Remove ViEEncoder::SetNetworkStatus" (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix bug in BitrateAllocator::Allocate(bitrate) Created 4 years, 7 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 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // Low REMB. Verify that all observers still get their respective min bitrate. 215 // Low REMB. Verify that all observers still get their respective min bitrate.
216 allocator_->OnNetworkChanged(1000, 0, 0); 216 allocator_->OnNetworkChanged(1000, 0, 0);
217 EXPECT_EQ(100000u, bitrate_observer_1.last_bitrate_); // Min cap. 217 EXPECT_EQ(100000u, bitrate_observer_1.last_bitrate_); // Min cap.
218 EXPECT_EQ(200000u, bitrate_observer_2.last_bitrate_); // Min cap. 218 EXPECT_EQ(200000u, bitrate_observer_2.last_bitrate_); // Min cap.
219 EXPECT_EQ(300000u, bitrate_observer_3.last_bitrate_); // Min cap. 219 EXPECT_EQ(300000u, bitrate_observer_3.last_bitrate_); // Min cap.
220 220
221 allocator_->RemoveObserver(&bitrate_observer_1); 221 allocator_->RemoveObserver(&bitrate_observer_1);
222 allocator_->RemoveObserver(&bitrate_observer_2); 222 allocator_->RemoveObserver(&bitrate_observer_2);
223 allocator_->RemoveObserver(&bitrate_observer_3); 223 allocator_->RemoveObserver(&bitrate_observer_3);
224 } 224 }
225
226 TEST_F(BitrateAllocatorTest, AddObserverWhileNetworkDown) {
227 TestBitrateObserver bitrate_observer_1;
228 int start_bitrate =
229 allocator_->AddObserver(&bitrate_observer_1, 50000, 400000, true);
230 EXPECT_EQ(300000, start_bitrate);
231
232 // Set network down, ie, no available bitrate.
233 allocator_->OnNetworkChanged(0, 0, 0);
234
235 EXPECT_EQ(0u, bitrate_observer_1.last_bitrate_);
236
237 TestBitrateObserver bitrate_observer_2;
238 start_bitrate =
239 allocator_->AddObserver(&bitrate_observer_2, 50000, 400000, true);
240
241 // Expect the start_bitrate to be set as if the network was still up but that
242 // the new observer have been notified that the network is down.
243 EXPECT_EQ(300000 / 2, start_bitrate);
244 EXPECT_EQ(0u, bitrate_observer_1.last_bitrate_);
245 EXPECT_EQ(0u, bitrate_observer_2.last_bitrate_);
246
247 // Set network back up.
248 allocator_->OnNetworkChanged(1500000, 0, 50);
249 EXPECT_EQ(750000u, bitrate_observer_1.last_bitrate_);
250 EXPECT_EQ(750000u, bitrate_observer_2.last_bitrate_);
251 }
252
225 } // namespace webrtc 253 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/bitrate_allocator.cc ('k') | webrtc/modules/congestion_controller/congestion_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698