hunspell: Cleanup to fix the header include guards under google/ directory.
[chromium-blink-merge.git] / tools / variations / fieldtrial_util_unittest.py
blob8f1c6d26a1a2e66dac233f0bcbf062bad0c1aaf4
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.
5 import unittest
7 import fieldtrial_util
8 import os
9 import tempfile
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:
20 config = '''{
21 "BrowserBlackList": [
22 { "group_name": "Enabled" }
24 "c": [
26 "group_name": "d.",
27 "params": {"url": "http://www.google.com"}
30 "SimpleParams": [
32 "group_name": "Default",
33 "params": {"id": "abc"}
36 }'''
37 try:
38 base_file.write(config)
39 base_file.close()
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)
46 finally:
47 os.unlink(base_file.name)
49 if __name__ == '__main__':
50 unittest.main()