Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1392)

Unified Diff: webrtc/test/field_trial.h

Issue 1227653002: Add scoped class for overriding field trials. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/test/field_trial.h
diff --git a/webrtc/test/field_trial.h b/webrtc/test/field_trial.h
index 6503254729ac1550da7a927cca79dbf264c626fd..d448f3411d5407253a788da95d0e8938dc78fa18 100644
--- a/webrtc/test/field_trial.h
+++ b/webrtc/test/field_trial.h
@@ -12,6 +12,7 @@
#define WEBRTC_TEST_FIELD_TRIAL_H_
#include <string>
+#include <map>
namespace webrtc {
namespace test {
@@ -31,6 +32,16 @@ namespace test {
// passed to it. That can be used to find out if a binary is parsing the flags.
void InitFieldTrialsFromString(const std::string& config);
+// This class is used to override field-trial configs within specific tests.
+// After this class goes out of scope previous field trials will be restored.
+class ScopedFieldTrials {
+ public:
+ explicit ScopedFieldTrials(const std::string& config);
+ ~ScopedFieldTrials();
+ private:
+ const std::map<std::string, std::string> previous_field_trials_;
+};
+
} // namespace test
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698