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

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc

Issue 1413053002: Change to use local Random object instead of global rand() in the RtcEventLog unit test. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Updated WebRTC unit tests to use the new functions in Random Created 5 years, 2 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 i == 0, false)); 276 i == 0, false));
277 } 277 }
278 278
279 RunFor(30 * 60 * 1000); 279 RunFor(30 * 60 * 1000);
280 } 280 }
281 281
282 TEST_P(BweSimulation, PacedSelfFairness50msTest) { 282 TEST_P(BweSimulation, PacedSelfFairness50msTest) {
283 const int64_t kAverageOffsetMs = 20 * 1000; 283 const int64_t kAverageOffsetMs = 20 * 1000;
284 const int kNumRmcatFlows = 4; 284 const int kNumRmcatFlows = 4;
285 int64_t offsets_ms[kNumRmcatFlows]; 285 int64_t offsets_ms[kNumRmcatFlows];
286 offsets_ms[0] = random_.Rand(0, 2 * kAverageOffsetMs); 286 offsets_ms[0] = random_.Uniform(2 * kAverageOffsetMs);
287 for (int i = 1; i < kNumRmcatFlows; ++i) { 287 for (int i = 1; i < kNumRmcatFlows; ++i) {
288 offsets_ms[i] = offsets_ms[i - 1] + random_.Rand(0, 2 * kAverageOffsetMs); 288 offsets_ms[i] = offsets_ms[i - 1] + random_.Uniform(2 * kAverageOffsetMs);
289 } 289 }
290 RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 1000, 3000, 50, 50, 0, 290 RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 1000, 3000, 50, 50, 0,
291 offsets_ms); 291 offsets_ms);
292 } 292 }
293 293
294 TEST_P(BweSimulation, PacedSelfFairness500msTest) { 294 TEST_P(BweSimulation, PacedSelfFairness500msTest) {
295 const int64_t kAverageOffsetMs = 20 * 1000; 295 const int64_t kAverageOffsetMs = 20 * 1000;
296 const int kNumRmcatFlows = 4; 296 const int kNumRmcatFlows = 4;
297 int64_t offsets_ms[kNumRmcatFlows]; 297 int64_t offsets_ms[kNumRmcatFlows];
298 offsets_ms[0] = random_.Rand(0, 2 * kAverageOffsetMs); 298 offsets_ms[0] = random_.Uniform(2 * kAverageOffsetMs);
299 for (int i = 1; i < kNumRmcatFlows; ++i) { 299 for (int i = 1; i < kNumRmcatFlows; ++i) {
300 offsets_ms[i] = offsets_ms[i - 1] + random_.Rand(0, 2 * kAverageOffsetMs); 300 offsets_ms[i] = offsets_ms[i - 1] + random_.Uniform(2 * kAverageOffsetMs);
301 } 301 }
302 RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 1000, 3000, 500, 50, 0, 302 RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 1000, 3000, 500, 50, 0,
303 offsets_ms); 303 offsets_ms);
304 } 304 }
305 305
306 TEST_P(BweSimulation, PacedSelfFairness1000msTest) { 306 TEST_P(BweSimulation, PacedSelfFairness1000msTest) {
307 const int64_t kAverageOffsetMs = 20 * 1000; 307 const int64_t kAverageOffsetMs = 20 * 1000;
308 const int kNumRmcatFlows = 4; 308 const int kNumRmcatFlows = 4;
309 int64_t offsets_ms[kNumRmcatFlows]; 309 int64_t offsets_ms[kNumRmcatFlows];
310 offsets_ms[0] = random_.Rand(0, 2 * kAverageOffsetMs); 310 offsets_ms[0] = random_.Uniform(2 * kAverageOffsetMs);
311 for (int i = 1; i < kNumRmcatFlows; ++i) { 311 for (int i = 1; i < kNumRmcatFlows; ++i) {
312 offsets_ms[i] = offsets_ms[i - 1] + random_.Rand(0, 2 * kAverageOffsetMs); 312 offsets_ms[i] = offsets_ms[i - 1] + random_.Uniform(2 * kAverageOffsetMs);
313 } 313 }
314 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 1000, 50, 0, offsets_ms); 314 RunFairnessTest(GetParam(), 4, 0, 1000, 3000, 1000, 50, 0, offsets_ms);
315 } 315 }
316 316
317 TEST_P(BweSimulation, TcpFairness50msTest) { 317 TEST_P(BweSimulation, TcpFairness50msTest) {
318 const int64_t kAverageOffsetMs = 20 * 1000; 318 const int64_t kAverageOffsetMs = 20 * 1000;
319 int64_t offset_ms[] = {random_.Rand(0, 2 * kAverageOffsetMs), 0}; 319 int64_t offset_ms[] = {random_.Uniform(2 * kAverageOffsetMs), 0};
320 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 50, 50, 0, offset_ms); 320 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 50, 50, 0, offset_ms);
321 } 321 }
322 322
323 TEST_P(BweSimulation, TcpFairness500msTest) { 323 TEST_P(BweSimulation, TcpFairness500msTest) {
324 const int64_t kAverageOffsetMs = 20 * 1000; 324 const int64_t kAverageOffsetMs = 20 * 1000;
325 int64_t offset_ms[] = {random_.Rand(0, 2 * kAverageOffsetMs), 0}; 325 int64_t offset_ms[] = {random_.Uniform(2 * kAverageOffsetMs), 0};
326 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 500, 50, 0, offset_ms); 326 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 500, 50, 0, offset_ms);
327 } 327 }
328 328
329 TEST_P(BweSimulation, TcpFairness1000msTest) { 329 TEST_P(BweSimulation, TcpFairness1000msTest) {
330 const int kAverageOffsetMs = 20 * 1000; 330 const int kAverageOffsetMs = 20 * 1000;
331 int64_t offset_ms[] = {random_.Rand(0, 2 * kAverageOffsetMs), 0}; 331 int64_t offset_ms[] = {random_.Uniform(2 * kAverageOffsetMs), 0};
332 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 1000, 50, 0, offset_ms); 332 RunFairnessTest(GetParam(), 1, 1, 1000, 2000, 1000, 50, 0, offset_ms);
333 } 333 }
334 334
335 // The following test cases begin with "Evaluation" as a referrence to the 335 // The following test cases begin with "Evaluation" as a referrence to the
336 // Internet draft https://tools.ietf.org/html/draft-ietf-rmcat-eval-test-01. 336 // Internet draft https://tools.ietf.org/html/draft-ietf-rmcat-eval-test-01.
337 337
338 TEST_P(BweSimulation, Evaluation1) { 338 TEST_P(BweSimulation, Evaluation1) {
339 RunVariableCapacity1SingleFlow(GetParam()); 339 RunVariableCapacity1SingleFlow(GetParam());
340 } 340 }
341 341
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 443
444 BweTest gcc_test(false); 444 BweTest gcc_test(false);
445 gcc_test.RunChoke(kFullSendSideEstimator, capacities_kbps); 445 gcc_test.RunChoke(kFullSendSideEstimator, capacities_kbps);
446 } 446 }
447 447
448 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE 448 #endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
449 } // namespace bwe 449 } // namespace bwe
450 } // namespace testing 450 } // namespace testing
451 } // namespace webrtc 451 } // namespace webrtc
452 452
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698