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

Unified Diff: tools/variations/fieldtrial_to_struct_unittest.py

Issue 2296493002: Merge all Field Trial Testing Configuration Together (Closed)
Patch Set: Rebase to a67debf Created 4 years, 3 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
« no previous file with comments | « tools/variations/fieldtrial_to_struct.py ('k') | tools/variations/unittest_data/test_config.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 042217f2601b97c6cfbdf0ba3850b11760c017f3..1c0c3f138f6659311473457f9f23e094647afa1c 100644
--- a/tools/variations/fieldtrial_to_struct_unittest.py
+++ b/tools/variations/fieldtrial_to_struct_unittest.py
@@ -14,27 +14,37 @@ class FieldTrialToStruct(unittest.TestCase):
config = {
'Trial1': [
{
- 'group_name': 'Group1',
- 'params': {
- 'x': '1',
- 'y': '2'
- },
- 'enable_features': ['A', 'B'],
- 'disable_features': ['C']
- },
- {
- 'group_name': 'Group2',
- 'params': {
- 'x': '3',
- 'y': '4'
- },
- 'enable_features': ['D', 'E'],
- 'disable_features': ['F']
+ 'platforms': ['win'],
+ 'experiments': [
+ {
+ 'name': 'Group1',
+ 'params': {
+ 'x': '1',
+ 'y': '2'
+ },
+ 'enable_features': ['A', 'B'],
+ 'disable_features': ['C']
+ },
+ {
+ 'name': 'Group2',
+ 'params': {
+ 'x': '3',
+ 'y': '4'
+ },
+ 'enable_features': ['D', 'E'],
+ 'disable_features': ['F']
+ },
+ ]
}
],
- 'Trial2': [{'group_name': 'OtherGroup'}]
+ 'Trial2': [
+ {
+ 'platforms': ['win'],
+ 'experiments': [{'name': 'OtherGroup'}]
+ }
+ ]
}
- result = fieldtrial_to_struct._FieldTrialConfigToDescription(config)
+ result = fieldtrial_to_struct._FieldTrialConfigToDescription(config, 'win')
expected = {
'elements': {
'kFieldTrialConfig': {
@@ -73,6 +83,110 @@ class FieldTrialToStruct(unittest.TestCase):
self.maxDiff = None
self.assertEqual(expected, result)
+ _MULTIPLE_PLATFORM_CONFIG = {
+ 'Trial1': [
+ {
+ 'platforms': ['win', 'ios'],
+ 'experiments': [
+ {
+ 'name': 'Group1',
+ 'params': {
+ 'x': '1',
+ 'y': '2'
+ },
+ 'enable_features': ['A', 'B'],
+ 'disable_features': ['C']
+ },
+ {
+ 'name': 'Group2',
+ 'params': {
+ 'x': '3',
+ 'y': '4'
+ },
+ 'enable_features': ['D', 'E'],
+ 'disable_features': ['F']
+ }
+ ]
+ },
+ {
+ 'platforms': ['ios'],
+ 'experiments': [
+ {
+ 'name': 'IOSOnly'
+ }
+ ]
+ },
+ ],
+ 'Trial2': [
+ {
+ 'platforms': ['win', 'mac'],
+ 'experiments': [{'name': 'OtherGroup'}]
+ }
+ ]
+ }
+
+ def test_FieldTrialToDescriptionMultipleSinglePlatformMultipleTrial(self):
+ result = fieldtrial_to_struct._FieldTrialConfigToDescription(
+ self._MULTIPLE_PLATFORM_CONFIG, 'ios')
+ expected = {
+ 'elements': {
+ 'kFieldTrialConfig': {
+ 'trials': [
+ {
+ 'name': 'Trial1',
+ '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']
+ },
+ {
+ 'name': 'IOSOnly'
+ },
+ ],
+ },
+ ]
+ }
+ }
+ }
+ self.maxDiff = None
+ self.assertEqual(expected, result)
+
+ def test_FieldTrialToDescriptionMultipleSinglePlatformSingleTrial(self):
+ result = fieldtrial_to_struct._FieldTrialConfigToDescription(
+ self._MULTIPLE_PLATFORM_CONFIG, 'mac')
+ expected = {
+ 'elements': {
+ 'kFieldTrialConfig': {
+ 'trials': [
+ {
+ 'name': 'Trial2',
+ 'groups': [
+ {
+ 'name': 'OtherGroup',
+ },
+ ],
+ },
+ ]
+ }
+ }
+ }
+ self.maxDiff = None
+ self.assertEqual(expected, result)
+
def test_FieldTrialToStructMain(self):
schema = (
'../../chrome/common/variations/fieldtrial_testing_config_schema.json')
@@ -80,6 +194,7 @@ class FieldTrialToStruct(unittest.TestCase):
fieldtrial_to_struct.main([
'--schema=' + schema,
'--output=' + test_output_filename,
+ '--platform=win',
'--year=2015',
'unittest_data/test_config.json'
])
« no previous file with comments | « tools/variations/fieldtrial_to_struct.py ('k') | tools/variations/unittest_data/test_config.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698