blob: 516faa051346a17a425b757437f6f29a2864dafd [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#ifndef TEST_FIELD_TRIAL_H_
12#define TEST_FIELD_TRIAL_H_
andresp@webrtc.org60015d22014-05-16 09:39:5113
Yves Gerey665174f2018-06-19 13:03:0514#include <string>
andresp@webrtc.org60015d22014-05-16 09:39:5115
Danil Chapovalov385b6c52022-04-08 14:01:5016#include "absl/strings/string_view.h"
17
andresp@webrtc.org60015d22014-05-16 09:39:5118namespace webrtc {
19namespace test {
andresp@webrtc.org60015d22014-05-16 09:39:5120
pbos19492f12015-07-07 15:22:2721// This class is used to override field-trial configs within specific tests.
22// After this class goes out of scope previous field trials will be restored.
23class ScopedFieldTrials {
24 public:
Danil Chapovalov385b6c52022-04-08 14:01:5025 explicit ScopedFieldTrials(absl::string_view config);
Sebastian Jansson9debe5a2019-03-22 14:42:3826 ScopedFieldTrials(const ScopedFieldTrials&) = delete;
27 ScopedFieldTrials& operator=(const ScopedFieldTrials&) = delete;
pbos19492f12015-07-07 15:22:2728 ~ScopedFieldTrials();
Yves Gerey665174f2018-06-19 13:03:0529
pbos19492f12015-07-07 15:22:2730 private:
phoglund37ebcf02016-01-08 13:04:5731 std::string current_field_trials_;
32 const char* previous_field_trials_;
pbos19492f12015-07-07 15:22:2733};
34
andresp@webrtc.org60015d22014-05-16 09:39:5135} // namespace test
36} // namespace webrtc
37
Mirko Bonadei92ea95e2017-09-15 04:47:3138#endif // TEST_FIELD_TRIAL_H_