Add support for lists to the FieldTrialParser.

List elements are separated by a |. If the key is given without a : we
treat that as a empty list.

We also support parsing multiple lists as a list-of-structs, see the
unit test for usage examples.

Bug: webrtc:9346
Change-Id: I32d3ce612fef476b1c481c00a893d7fa2f339e92
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130464
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27560}
This commit is contained in:
Jonas Olsson
2019-04-11 11:53:26 +02:00
committed by Commit Bot
parent 7ddef1af88
commit 97d84ef78e
7 changed files with 450 additions and 9 deletions

View File

@ -8,9 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/experiments/field_trial_parser.h"
#include "rtc_base/experiments/field_trial_list.h"
#include "rtc_base/gunit.h"
#include "system_wrappers/include/field_trial.h"
#include "test/field_trial.h"
#include "test/gmock.h"
namespace webrtc {
namespace {
@ -38,6 +41,7 @@ enum class CustomEnum {
kRed = 1,
kBlue = 2,
};
} // namespace
TEST(FieldTrialParserTest, ParsesValidParameters) {
@ -152,4 +156,5 @@ TEST(FieldTrialParserTest, ParsesCustomEnumParameter) {
ParseFieldTrial({&my_enum}, "e:5");
EXPECT_EQ(my_enum.Get(), CustomEnum::kBlue);
}
} // namespace webrtc