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

Unified Diff: webrtc/test/field_trial.cc

Issue 1215713019: Fix follow-up in webrtc/test/field_trial.cc. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/test/field_trial.cc
diff --git a/webrtc/test/field_trial.cc b/webrtc/test/field_trial.cc
index 05ca052a57051041c53e6ec2860126190ac6b459..51bd920dab2737fdeaad2febd355a1a50fc5fde2 100644
--- a/webrtc/test/field_trial.cc
+++ b/webrtc/test/field_trial.cc
@@ -46,7 +46,7 @@ void InitFieldTrialsFromString(const std::string& trials_string) {
static const char kPersistentStringSeparator = '/';
// Catch an error if this is called more than once.
- assert(field_trials_initiated_ == false);
+ assert(!field_trials_initiated_);
field_trials_initiated_ = true;
if (trials_string.empty())
@@ -77,10 +77,10 @@ void InitFieldTrialsFromString(const std::string& trials_string) {
if (next_item == trials_string.length())
return;
}
- // LOG does not prints when this is called early on main.
+ // Using fprintf as LOG does not print when this is called early in main.
fprintf(stderr, "Invalid field trials string.\n");
- // Using abort so it crashs both in debug and release mode.
+ // Using abort so it crashes in both debug and release mode.
abort();
}
@@ -88,11 +88,14 @@ ScopedFieldTrials::ScopedFieldTrials(const std::string& config)
: previous_field_trials_(field_trials_) {
assert(field_trials_initiated_);
field_trials_initiated_ = false;
- field_trials_ = std::map<std::string, std::string>();
+ field_trials_.clear();
InitFieldTrialsFromString(config);
}
ScopedFieldTrials::~ScopedFieldTrials() {
+ // Should still be initialized, since InitFieldTrials is called from ctor.
+ // That's why we don't restore the flag.
+ assert(field_trials_initiated_);
field_trials_ = previous_field_trials_;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698