blob: c482ca5aa803a39e3caec0009f7b9f12f02d293d [file] [log] [blame]
andresp@webrtc.org60015d22014-05-16 09:39:51 +00001/*
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 06:47:31 +020011#ifndef TEST_FIELD_TRIAL_H_
12#define TEST_FIELD_TRIAL_H_
andresp@webrtc.org60015d22014-05-16 09:39:51 +000013
pbos19492f12015-07-07 08:22:27 -070014#include <map>
Yves Gerey665174f2018-06-19 15:03:05 +020015#include <string>
andresp@webrtc.org60015d22014-05-16 09:39:51 +000016
17namespace webrtc {
18namespace test {
Jonas Olsson5b2eda42019-06-11 14:29:40 +020019// TODO(jonasolsson): remove once all internal usages are gone.
20void ValidateFieldTrialsStringOrDie(const std::string&);
andresp@webrtc.org60015d22014-05-16 09:39:51 +000021
pbos19492f12015-07-07 08:22:27 -070022// This class is used to override field-trial configs within specific tests.
23// After this class goes out of scope previous field trials will be restored.
24class ScopedFieldTrials {
25 public:
26 explicit ScopedFieldTrials(const std::string& config);
Sebastian Jansson9debe5a2019-03-22 15:42:38 +010027 ScopedFieldTrials(const ScopedFieldTrials&) = delete;
28 ScopedFieldTrials& operator=(const ScopedFieldTrials&) = delete;
pbos19492f12015-07-07 08:22:27 -070029 ~ScopedFieldTrials();
Yves Gerey665174f2018-06-19 15:03:05 +020030
pbos19492f12015-07-07 08:22:27 -070031 private:
phoglund37ebcf02016-01-08 05:04:57 -080032 std::string current_field_trials_;
33 const char* previous_field_trials_;
pbos19492f12015-07-07 08:22:27 -070034};
35
andresp@webrtc.org60015d22014-05-16 09:39:51 +000036} // namespace test
37} // namespace webrtc
38
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020039#endif // TEST_FIELD_TRIAL_H_