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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 expected_output = self.NEWLINE.join([ | 70 expected_output = self.NEWLINE.join([ |
71 'Windows Registry Editor Version 5.00', | 71 'Windows Registry Editor Version 5.00', |
72 '', | 72 '', |
73 '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Google\\Chrome]', | 73 '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Google\\Chrome]', |
74 '"MainPolicy"=dword:00000001', | 74 '"MainPolicy"=dword:00000001', |
75 '', | 75 '', |
76 '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Google\\Chrome\\Recommended]', | 76 '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Google\\Chrome\\Recommended]', |
77 '"MainPolicy"=dword:00000001']) | 77 '"MainPolicy"=dword:00000001']) |
78 self.CompareOutputs(output, expected_output) | 78 self.CompareOutputs(output, expected_output) |
79 | 79 |
| 80 def testRecommendedMainPolicy(self): |
| 81 # Tests a policy group with a single policy of type 'main'. |
| 82 grd = self.PrepareTest( |
| 83 '{' |
| 84 ' "policy_definitions": [' |
| 85 ' {' |
| 86 ' "name": "MainPolicy",' |
| 87 ' "type": "main",' |
| 88 ' "features": {' |
| 89 ' "can_be_recommended": True,' |
| 90 ' "can_be_mandatory": False ' |
| 91 ' },' |
| 92 ' "caption": "",' |
| 93 ' "desc": "",' |
| 94 ' "supported_on": ["chrome.win:8-"],' |
| 95 ' "example_value": True' |
| 96 ' },' |
| 97 ' ],' |
| 98 ' "placeholders": [],' |
| 99 ' "messages": {},' |
| 100 '}') |
| 101 output = self.GetOutput(grd, 'fr', {'_google_chrome' : '1'}, 'reg', 'en') |
| 102 expected_output = self.NEWLINE.join([ |
| 103 'Windows Registry Editor Version 5.00', |
| 104 '', |
| 105 '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Google\\Chrome\\Recommended]', |
| 106 '"MainPolicy"=dword:00000001']) |
| 107 self.CompareOutputs(output, expected_output) |
| 108 |
80 def testStringPolicy(self): | 109 def testStringPolicy(self): |
81 # Tests a policy group with a single policy of type 'string'. | 110 # Tests a policy group with a single policy of type 'string'. |
82 grd = self.PrepareTest( | 111 grd = self.PrepareTest( |
83 '{' | 112 '{' |
84 ' "policy_definitions": [' | 113 ' "policy_definitions": [' |
85 ' {' | 114 ' {' |
86 ' "name": "StringPolicy",' | 115 ' "name": "StringPolicy",' |
87 ' "type": "string",' | 116 ' "type": "string",' |
88 ' "caption": "",' | 117 ' "caption": "",' |
89 ' "desc": "",' | 118 ' "desc": "",' |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 '"Policy2"="c"', | 369 '"Policy2"="c"', |
341 '', | 370 '', |
342 '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Chromium\\Policy1]', | 371 '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Chromium\\Policy1]', |
343 '"1"="a"', | 372 '"1"="a"', |
344 '"2"="b"']) | 373 '"2"="b"']) |
345 self.CompareOutputs(output, expected_output) | 374 self.CompareOutputs(output, expected_output) |
346 | 375 |
347 | 376 |
348 if __name__ == '__main__': | 377 if __name__ == '__main__': |
349 unittest.main() | 378 unittest.main() |
OLD | NEW |