2014-05-16 09:39:51 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "test/field_trial.h"
|
2014-05-16 09:39:51 +00:00
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
2022-04-08 16:01:50 +02:00
|
|
|
#include "absl/strings/string_view.h"
|
2021-08-23 17:39:58 +02:00
|
|
|
#include "rtc_base/checks.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "system_wrappers/include/field_trial.h"
|
2014-05-16 09:39:51 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
2015-07-07 08:22:27 -07:00
|
|
|
|
2022-04-08 16:01:50 +02:00
|
|
|
ScopedFieldTrials::ScopedFieldTrials(absl::string_view config)
|
|
|
|
|
: current_field_trials_(config),
|
|
|
|
|
previous_field_trials_(webrtc::field_trial::GetFieldTrialString()) {
|
|
|
|
|
RTC_CHECK(webrtc::field_trial::FieldTrialsStringIsValid(
|
|
|
|
|
current_field_trials_.c_str()))
|
|
|
|
|
<< "Invalid field trials string: " << current_field_trials_;
|
2018-01-31 17:23:40 +01:00
|
|
|
webrtc::field_trial::InitFieldTrialsFromString(current_field_trials_.c_str());
|
2015-07-07 08:22:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScopedFieldTrials::~ScopedFieldTrials() {
|
2021-08-23 17:39:58 +02:00
|
|
|
RTC_CHECK(
|
|
|
|
|
webrtc::field_trial::FieldTrialsStringIsValid(previous_field_trials_))
|
|
|
|
|
<< "Invalid field trials string: " << previous_field_trials_;
|
2016-01-08 05:04:57 -08:00
|
|
|
webrtc::field_trial::InitFieldTrialsFromString(previous_field_trials_);
|
2015-07-07 08:22:27 -07:00
|
|
|
}
|
|
|
|
|
|
2014-05-16 09:39:51 +00:00
|
|
|
} // namespace test
|
|
|
|
|
} // namespace webrtc
|