blob: 3d6c6ac61708ebbcb1fd2bfe6b250046dbcbd4c5 [file] [log] [blame]
andresp@webrtc.org60015d22014-05-16 09:39:511/*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 04:47:3111#include "test/field_trial.h"
andresp@webrtc.org60015d22014-05-16 09:39:5112
andresp@webrtc.org60015d22014-05-16 09:39:5113#include <string>
14
Danil Chapovalov385b6c52022-04-08 14:01:5015#include "absl/strings/string_view.h"
Mirko Bonadeif3db00f2021-08-23 15:39:5816#include "rtc_base/checks.h"
Mirko Bonadei92ea95e2017-09-15 04:47:3117#include "system_wrappers/include/field_trial.h"
andresp@webrtc.org60015d22014-05-16 09:39:5118
19namespace webrtc {
andresp@webrtc.org60015d22014-05-16 09:39:5120namespace test {
pbos19492f12015-07-07 15:22:2721
Danil Chapovalov385b6c52022-04-08 14:01:5022ScopedFieldTrials::ScopedFieldTrials(absl::string_view config)
23 : current_field_trials_(config),
24 previous_field_trials_(webrtc::field_trial::GetFieldTrialString()) {
25 RTC_CHECK(webrtc::field_trial::FieldTrialsStringIsValid(
26 current_field_trials_.c_str()))
27 << "Invalid field trials string: " << current_field_trials_;
Bjorn Tereliusedab3012018-01-31 16:23:4028 webrtc::field_trial::InitFieldTrialsFromString(current_field_trials_.c_str());
pbos19492f12015-07-07 15:22:2729}
30
31ScopedFieldTrials::~ScopedFieldTrials() {
Mirko Bonadeif3db00f2021-08-23 15:39:5832 RTC_CHECK(
33 webrtc::field_trial::FieldTrialsStringIsValid(previous_field_trials_))
34 << "Invalid field trials string: " << previous_field_trials_;
phoglund37ebcf02016-01-08 13:04:5735 webrtc::field_trial::InitFieldTrialsFromString(previous_field_trials_);
pbos19492f12015-07-07 15:22:2736}
37
andresp@webrtc.org60015d22014-05-16 09:39:5138} // namespace test
39} // namespace webrtc