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

Side by Side Diff: webrtc/test/field_trial.cc

Issue 1151603008: Make the BWE threshold adaptive. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Tests. Created 5 years, 5 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 27 matching lines...) Expand all
38 return it->second; 38 return it->second;
39 } 39 }
40 } // namespace field_trial 40 } // namespace field_trial
41 41
42 namespace test { 42 namespace test {
43 // Note: this code is copied from src/base/metrics/field_trial.cc since the aim 43 // Note: this code is copied from src/base/metrics/field_trial.cc since the aim
44 // is to mimic chromium --force-fieldtrials. 44 // is to mimic chromium --force-fieldtrials.
45 void InitFieldTrialsFromString(const std::string& trials_string) { 45 void InitFieldTrialsFromString(const std::string& trials_string) {
46 static const char kPersistentStringSeparator = '/'; 46 static const char kPersistentStringSeparator = '/';
47 47
48 // Catch an error if this is called more than once. 48 assert(!field_trials_initiated_ || trials_string.empty());
49 assert(field_trials_initiated_ == false); 49
50 field_trials_initiated_ = true; 50 field_trials_initiated_ = true;
51 51
52 if (trials_string.empty()) return; 52 if (trials_string.empty()) {
pbos-webrtc 2015/07/06 13:30:17 trials_string == "" reads better
53 field_trials_.clear();
54 return;
55 }
53 56
54 size_t next_item = 0; 57 size_t next_item = 0;
55 while (next_item < trials_string.length()) { 58 while (next_item < trials_string.length()) {
56 size_t name_end = trials_string.find(kPersistentStringSeparator, next_item); 59 size_t name_end = trials_string.find(kPersistentStringSeparator, next_item);
57 if (name_end == trials_string.npos || next_item == name_end) 60 if (name_end == trials_string.npos || next_item == name_end)
58 break; 61 break;
59 size_t group_name_end = trials_string.find(kPersistentStringSeparator, 62 size_t group_name_end = trials_string.find(kPersistentStringSeparator,
60 name_end + 1); 63 name_end + 1);
61 if (group_name_end == trials_string.npos || name_end + 1 == group_name_end) 64 if (group_name_end == trials_string.npos || name_end + 1 == group_name_end)
62 break; 65 break;
(...skipping 14 matching lines...) Expand all
77 return; 80 return;
78 } 81 }
79 // LOG does not prints when this is called early on main. 82 // LOG does not prints when this is called early on main.
80 fprintf(stderr, "Invalid field trials string.\n"); 83 fprintf(stderr, "Invalid field trials string.\n");
81 84
82 // Using abort so it crashs both in debug and release mode. 85 // Using abort so it crashs both in debug and release mode.
83 abort(); 86 abort();
84 } 87 }
85 } // namespace test 88 } // namespace test
86 } // namespace webrtc 89 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698