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

Unified Diff: tools/variations/fieldtrial_util_unittest.py

Issue 2381663002: Revert of Update fieldtrial_util To Handle Combined Fieldtrial Config Format (Closed)
Patch Set: 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_util.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/variations/fieldtrial_util_unittest.py
diff --git a/tools/variations/fieldtrial_util_unittest.py b/tools/variations/fieldtrial_util_unittest.py
index a215201a5fb43001544de8c5783d5435647b5639..9d53a7f3ea837e298ec68ecb24633f1a0df64a3f 100644
--- a/tools/variations/fieldtrial_util_unittest.py
+++ b/tools/variations/fieldtrial_util_unittest.py
@@ -11,91 +11,68 @@
class FieldTrialUtilUnittest(unittest.TestCase):
- def runGenerateArgs(self, config, platform):
+ def runGenerateArgs(self, config):
result = None
with tempfile.NamedTemporaryFile('w', delete=False) as base_file:
try:
base_file.write(config)
base_file.close()
- result = fieldtrial_util.GenerateArgs(base_file.name, platform)
+ result = fieldtrial_util.GenerateArgs(base_file.name)
finally:
os.unlink(base_file.name)
return result
def test_GenArgsEmptyPaths(self):
- args = fieldtrial_util.GenerateArgs('', 'linux')
+ args = fieldtrial_util.GenerateArgs('')
self.assertEqual([], args)
def test_GenArgsOneConfig(self):
config = '''{
"BrowserBlackList": [
+ { "group_name": "Enabled" }
+ ],
+ "c": [
{
- "platforms": ["win"],
- "experiments": [{"name": "Enabled"}]
+ "group_name": "d.",
+ "params": {"url": "http://www.google.com"},
+ "enable_features": ["x"],
+ "disable_features": ["y"]
}
],
"SimpleParams": [
{
- "platforms": ["win"],
- "experiments": [
- {
- "name": "Default",
- "params": {"id": "abc"},
- "enable_features": ["a", "b"]
- }
- ]
- }
- ],
- "c": [
- {
- "platforms": ["win"],
- "experiments": [
- {
- "name": "d.",
- "params": {"url": "http://www.google.com"},
- "enable_features": ["x"],
- "disable_features": ["y"]
- }
- ]
+ "group_name": "Default",
+ "params": {"id": "abc"},
+ "enable_features": ["a", "b"]
}
]
}'''
- result = self.runGenerateArgs(config, 'win')
+ result = self.runGenerateArgs(config)
self.assertEqual(['--force-fieldtrials='
- 'BrowserBlackList/Enabled/SimpleParams/Default/c/d.',
+ 'BrowserBlackList/Enabled/c/d./SimpleParams/Default',
'--force-fieldtrial-params='
- 'SimpleParams.Default:id/abc,'
- 'c.d%2E:url/http%3A%2F%2Fwww%2Egoogle%2Ecom',
- '--enable-features=a,b,x',
+ 'c.d%2E:url/http%3A%2F%2Fwww%2Egoogle%2Ecom,'
+ 'SimpleParams.Default:id/abc',
+ '--enable-features=x,a,b',
'--disable-features=y'], result)
def test_DuplicateEnableFeatures(self):
config = '''{
"X": [
{
- "platforms": ["win"],
- "experiments": [
- {
- "name": "x",
- "enable_features": ["x"]
- }
- ]
+ "group_name": "x",
+ "enable_features": ["x"]
}
],
"Y": [
{
- "platforms": ["win"],
- "experiments": [
- {
- "name": "Default",
- "enable_features": ["x", "y"]
- }
- ]
+ "group_name": "Default",
+ "enable_features": ["x", "y"]
}
]
}'''
with self.assertRaises(Exception) as raised:
- self.runGenerateArgs(config, 'win')
+ self.runGenerateArgs(config)
self.assertEqual('Duplicate feature(s) in enable_features: x',
str(raised.exception))
@@ -103,29 +80,19 @@
config = '''{
"X": [
{
- "platforms": ["win"],
- "experiments": [
- {
- "name": "x",
- "enable_features": ["y", "z"]
- }
- ]
+ "group_name": "x",
+ "enable_features": ["y", "z"]
}
],
"Y": [
{
- "platforms": ["win"],
- "experiments": [
- {
- "name": "Default",
- "enable_features": ["z", "x", "y"]
- }
- ]
+ "group_name": "Default",
+ "enable_features": ["z", "x", "y"]
}
]
}'''
with self.assertRaises(Exception) as raised:
- self.runGenerateArgs(config, 'win')
+ self.runGenerateArgs(config)
self.assertEqual('Duplicate feature(s) in enable_features: y, z',
str(raised.exception))
@@ -134,31 +101,21 @@
config = '''{
"X": [
{
- "platforms": ["win"],
- "experiments": [
- {
- "name": "x",
- "enable_features": ["x"]
- }
- ]
+ "group_name": "x",
+ "enable_features": ["x"]
}
],
"Y": [
{
- "platforms": ["win"],
- "experiments": [
- {
- "name": "Default",
- "disable_features": ["x", "y"]
- }
- ]
+ "group_name": "Default",
+ "disable_features": ["x", "y"]
}
]
}'''
with self.assertRaises(Exception) as raised:
- self.runGenerateArgs(config, 'win')
+ self.runGenerateArgs(config)
self.assertEqual('Conflicting features set as both enabled and disabled: x',
str(raised.exception))
if __name__ == '__main__':
- unittest.main()
+ unittest.main()
« no previous file with comments | « tools/variations/fieldtrial_util.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698