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 
11 #ifndef TEST_FIELD_TRIAL_H_
12 #define TEST_FIELD_TRIAL_H_
13 
14 #include <map>
15 #include <string>
16 
17 namespace webrtc {
18 namespace test {
19 // TODO(jonasolsson): remove once all internal usages are gone.
20 void ValidateFieldTrialsStringOrDie(const std::string&);
21 
22 // 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.
24 class ScopedFieldTrials {
25  public:
26   explicit ScopedFieldTrials(const std::string& config);
27   ScopedFieldTrials(const ScopedFieldTrials&) = delete;
28   ScopedFieldTrials& operator=(const ScopedFieldTrials&) = delete;
29   ~ScopedFieldTrials();
30 
31  private:
32   std::string current_field_trials_;
33   const char* previous_field_trials_;
34 };
35 
36 }  // namespace test
37 }  // namespace webrtc
38 
39 #endif  // TEST_FIELD_TRIAL_H_
40