andresp@webrtc.org | 60015d2 | 2014-05-16 09:39:51 | [diff] [blame] | 1 | /* |
| 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 Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 11 | #ifndef TEST_FIELD_TRIAL_H_ |
| 12 | #define TEST_FIELD_TRIAL_H_ |
andresp@webrtc.org | 60015d2 | 2014-05-16 09:39:51 | [diff] [blame] | 13 | |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 14 | #include <string> |
andresp@webrtc.org | 60015d2 | 2014-05-16 09:39:51 | [diff] [blame] | 15 | |
Danil Chapovalov | 385b6c5 | 2022-04-08 14:01:50 | [diff] [blame] | 16 | #include "absl/strings/string_view.h" |
| 17 | |
andresp@webrtc.org | 60015d2 | 2014-05-16 09:39:51 | [diff] [blame] | 18 | namespace webrtc { |
| 19 | namespace test { |
andresp@webrtc.org | 60015d2 | 2014-05-16 09:39:51 | [diff] [blame] | 20 | |
pbos | 19492f1 | 2015-07-07 15:22:27 | [diff] [blame] | 21 | // 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. |
| 23 | class ScopedFieldTrials { |
| 24 | public: |
Danil Chapovalov | 385b6c5 | 2022-04-08 14:01:50 | [diff] [blame] | 25 | explicit ScopedFieldTrials(absl::string_view config); |
Sebastian Jansson | 9debe5a | 2019-03-22 14:42:38 | [diff] [blame] | 26 | ScopedFieldTrials(const ScopedFieldTrials&) = delete; |
| 27 | ScopedFieldTrials& operator=(const ScopedFieldTrials&) = delete; |
pbos | 19492f1 | 2015-07-07 15:22:27 | [diff] [blame] | 28 | ~ScopedFieldTrials(); |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 29 | |
pbos | 19492f1 | 2015-07-07 15:22:27 | [diff] [blame] | 30 | private: |
phoglund | 37ebcf0 | 2016-01-08 13:04:57 | [diff] [blame] | 31 | std::string current_field_trials_; |
| 32 | const char* previous_field_trials_; |
pbos | 19492f1 | 2015-07-07 15:22:27 | [diff] [blame] | 33 | }; |
| 34 | |
andresp@webrtc.org | 60015d2 | 2014-05-16 09:39:51 | [diff] [blame] | 35 | } // namespace test |
| 36 | } // namespace webrtc |
| 37 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 38 | #endif // TEST_FIELD_TRIAL_H_ |