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

Unified Diff: tools/variations/fieldtrial_to_struct_unittest.py

Issue 2259443003: Capture All Groups in the Field Trial For Testing Studies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR Feedback and Change NOTREACHED() to DLOG(ERROR) Created 4 years, 4 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: tools/variations/fieldtrial_to_struct_unittest.py
diff --git a/tools/variations/fieldtrial_to_struct_unittest.py b/tools/variations/fieldtrial_to_struct_unittest.py
index 7575e833ebfaceffd8a9652878b0eeaa729493f0..ce96eca231e65f0547ef5ac00f1c35579257f62b 100644
--- a/tools/variations/fieldtrial_to_struct_unittest.py
+++ b/tools/variations/fieldtrial_to_struct_unittest.py
@@ -21,6 +21,15 @@ class FieldTrialToStruct(unittest.TestCase):
},
'enable_features': ['A', 'B'],
'disable_features': ['C']
+ },
+ {
+ 'group_name': 'Group2',
+ 'params': {
+ 'x': '3',
+ 'y': '4'
+ },
+ 'enable_features': ['D', 'E'],
+ 'disable_features': ['F']
}
],
'Study2': [{'group_name': 'OtherGroup'}]
@@ -29,22 +38,34 @@ class FieldTrialToStruct(unittest.TestCase):
expected = {
'elements': {
'kFieldTrialConfig': {
- 'groups': [
+ 'studies': [
{
- 'study': 'Study1',
- 'group_name': 'Group1',
- 'params': [
- {'key': 'x', 'value': '1'},
- {'key': 'y', 'value': '2'}
+ 'name': 'Study1',
+ 'groups': [
+ {
+ 'name': 'Group1',
+ 'params': [
+ {'key': 'x', 'value': '1'},
+ {'key': 'y', 'value': '2'}
+ ],
+ 'enable_features': ['A', 'B'],
+ 'disable_features': ['C']
+ },
+ {
+ 'name': 'Group2',
+ 'params': [
+ {'key': 'x', 'value': '3'},
+ {'key': 'y', 'value': '4'}
+ ],
+ 'enable_features': ['D', 'E'],
+ 'disable_features': ['F']
+ },
],
- 'enable_features': ['A',
- 'B'],
- 'disable_features': ['C']
},
{
- 'study': 'Study2',
- 'group_name': 'OtherGroup'
- }
+ 'name': 'Study2',
+ 'groups': [{'name': 'OtherGroup'}]
+ },
]
}
}
@@ -55,14 +76,14 @@ class FieldTrialToStruct(unittest.TestCase):
def test_FieldTrialToStructMain(self):
schema = (
'../../chrome/common/variations/fieldtrial_testing_config_schema.json')
- test_ouput_filename = 'test_ouput'
+ test_output_filename = 'test_output'
fieldtrial_to_struct.main([
'--schema=' + schema,
- '--output=' + test_ouput_filename,
+ '--output=' + test_output_filename,
'--year=2015',
'unittest_data/test_config.json'
])
- header_filename = test_ouput_filename + '.h'
+ header_filename = test_output_filename + '.h'
with open(header_filename, 'r') as header:
test_header = header.read()
with open('unittest_data/expected_output.h', 'r') as expected:
@@ -70,7 +91,7 @@ class FieldTrialToStruct(unittest.TestCase):
self.assertEqual(expected_header, test_header)
os.unlink(header_filename)
- cc_filename = test_ouput_filename + '.cc'
+ cc_filename = test_output_filename + '.cc'
with open(cc_filename, 'r') as cc:
test_cc = cc.read()
with open('unittest_data/expected_output.cc', 'r') as expected:

Powered by Google App Engine
This is Rietveld 408576698