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

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

Issue 1228913003: Remove empty-string comparisons. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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
« no previous file with comments | « webrtc/modules/video_coding/main/test/video_rtp_play.cc ('k') | webrtc/tools/agc/agc_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Catch an error if this is called more than once.
49 assert(field_trials_initiated_ == false); 49 assert(field_trials_initiated_ == false);
50 field_trials_initiated_ = true; 50 field_trials_initiated_ = true;
51 51
52 if (trials_string == "") 52 if (trials_string.empty())
53 return; 53 return;
54 54
55 size_t next_item = 0; 55 size_t next_item = 0;
56 while (next_item < trials_string.length()) { 56 while (next_item < trials_string.length()) {
57 size_t name_end = trials_string.find(kPersistentStringSeparator, next_item); 57 size_t name_end = trials_string.find(kPersistentStringSeparator, next_item);
58 if (name_end == trials_string.npos || next_item == name_end) 58 if (name_end == trials_string.npos || next_item == name_end)
59 break; 59 break;
60 size_t group_name_end = trials_string.find(kPersistentStringSeparator, 60 size_t group_name_end = trials_string.find(kPersistentStringSeparator,
61 name_end + 1); 61 name_end + 1);
62 if (group_name_end == trials_string.npos || name_end + 1 == group_name_end) 62 if (group_name_end == trials_string.npos || name_end + 1 == group_name_end)
(...skipping 28 matching lines...) Expand all
91 field_trials_ = std::map<std::string, std::string>(); 91 field_trials_ = std::map<std::string, std::string>();
92 InitFieldTrialsFromString(config); 92 InitFieldTrialsFromString(config);
93 } 93 }
94 94
95 ScopedFieldTrials::~ScopedFieldTrials() { 95 ScopedFieldTrials::~ScopedFieldTrials() {
96 field_trials_ = previous_field_trials_; 96 field_trials_ = previous_field_trials_;
97 } 97 }
98 98
99 } // namespace test 99 } // namespace test
100 } // namespace webrtc 100 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/main/test/video_rtp_play.cc ('k') | webrtc/tools/agc/agc_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698