1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
12 class FieldTrialUtilUnittest(unittest
.TestCase
):
14 def test_GenArgsEmptyPaths(self
):
15 args
= fieldtrial_util
.GenerateArgs('')
16 self
.assertEqual([], args
)
18 def test_GenArgsOneConfig(self
):
19 with tempfile
.NamedTemporaryFile('w', delete
=False) as base_file
:
22 { "group_name": "Enabled" }
27 "params": {"url": "http://www.google.com"}
32 "group_name": "Default",
33 "params": {"id": "abc"}
38 base_file
.write(config
)
40 result
= fieldtrial_util
.GenerateArgs(base_file
.name
)
41 self
.assertEqual(['--force-fieldtrials='
42 'BrowserBlackList/Enabled/c/d./SimpleParams/Default',
43 '--force-fieldtrial-params='
44 'c.d%2E:url/http%3A%2F%2Fwww%2Egoogle%2Ecom,'
45 'SimpleParams.Default:id/abc'], result
)
47 os
.unlink(base_file
.name
)
49 if __name__
== '__main__':