OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 | 6 |
7 '''Unit tests for grit.format.policy_templates.writers.reg_writer''' | 7 '''Unit tests for grit.format.policy_templates.writers.reg_writer''' |
8 | 8 |
9 | 9 |
10 import os | 10 import os |
(...skipping 30 matching lines...) Expand all Loading... | |
41 grd = self.PrepareTest( | 41 grd = self.PrepareTest( |
42 '{' | 42 '{' |
43 ' "policy_definitions": [],' | 43 ' "policy_definitions": [],' |
44 ' "placeholders": [],' | 44 ' "placeholders": [],' |
45 ' "messages": {}' | 45 ' "messages": {}' |
46 '}') | 46 '}') |
47 output = self.GetOutput(grd, 'fr', {'_chromium': '1', }, 'reg', 'en') | 47 output = self.GetOutput(grd, 'fr', {'_chromium': '1', }, 'reg', 'en') |
48 expected_output = 'Windows Registry Editor Version 5.00' | 48 expected_output = 'Windows Registry Editor Version 5.00' |
49 self.CompareOutputs(output, expected_output) | 49 self.CompareOutputs(output, expected_output) |
50 | 50 |
51 def testEmptyVersion(self): | |
52 # Test the handling of an empty policy list. | |
53 grd = self.PrepareTest( | |
54 '{' | |
55 ' "policy_definitions": [],' | |
56 ' "placeholders": [],' | |
57 ' "messages": {}' | |
58 '}') | |
59 output = self.GetOutput( | |
60 grd, 'fr', {'_chromium': '1', 'version': '39.0.0.0' }, 'reg', 'en') | |
61 expected_output = ('; chromium version: 39.0.0.0\r\n' | |
62 'Windows Registry Editor Version 5.00\r\n') | |
Joao da Silva
2014/10/14 19:05:21
The .reg file format isn't very well specified. Th
cschuet (SLOW)
2014/10/14 21:04:53
Done.
cschuet (SLOW)
2014/10/14 21:04:53
Done.
| |
63 self.CompareOutputs(output, expected_output) | |
64 | |
51 def testMainPolicy(self): | 65 def testMainPolicy(self): |
52 # Tests a policy group with a single policy of type 'main'. | 66 # Tests a policy group with a single policy of type 'main'. |
53 grd = self.PrepareTest( | 67 grd = self.PrepareTest( |
54 '{' | 68 '{' |
55 ' "policy_definitions": [' | 69 ' "policy_definitions": [' |
56 ' {' | 70 ' {' |
57 ' "name": "MainPolicy",' | 71 ' "name": "MainPolicy",' |
58 ' "type": "main",' | 72 ' "type": "main",' |
59 ' "features": { "can_be_recommended": True },' | 73 ' "features": { "can_be_recommended": True },' |
60 ' "caption": "",' | 74 ' "caption": "",' |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
369 '"Policy2"="c"', | 383 '"Policy2"="c"', |
370 '', | 384 '', |
371 '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Chromium\\Policy1]', | 385 '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Chromium\\Policy1]', |
372 '"1"="a"', | 386 '"1"="a"', |
373 '"2"="b"']) | 387 '"2"="b"']) |
374 self.CompareOutputs(output, expected_output) | 388 self.CompareOutputs(output, expected_output) |
375 | 389 |
376 | 390 |
377 if __name__ == '__main__': | 391 if __name__ == '__main__': |
378 unittest.main() | 392 unittest.main() |
OLD | NEW |