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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 ' "messages": {},' | 205 ' "messages": {},' |
206 '}') | 206 '}') |
207 output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'reg', 'en') | 207 output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'reg', 'en') |
208 expected_output = self.NEWLINE.join([ | 208 expected_output = self.NEWLINE.join([ |
209 'Windows Registry Editor Version 5.00', | 209 'Windows Registry Editor Version 5.00', |
210 '', | 210 '', |
211 '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Chromium\\ListPolicy]', | 211 '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Chromium\\ListPolicy]', |
212 '"1"="foo"', | 212 '"1"="foo"', |
213 '"2"="bar"']) | 213 '"2"="bar"']) |
214 | 214 |
215 def testStringEnumListPolicy(self): | |
216 # Tests a policy group with a single policy of type 'list'. | |
Joao da Silva
2014/06/25 16:46:57
string-enum-list
Andrew T Wilson (Slow)
2014/06/26 08:08:57
Done.
| |
217 grd = self.PrepareTest( | |
218 '{' | |
219 ' "policy_definitions": [' | |
220 ' {' | |
221 ' "name": "ListPolicy",' | |
222 ' "type": "string-enum-list",' | |
223 ' "caption": "",' | |
224 ' "desc": "",' | |
225 ' "items": [' | |
226 ' {"name": "ProxyServerDisabled", "value": "foo",' | |
227 ' "caption": ""},' | |
228 ' {"name": "ProxyServerAutoDetect", "value": "bar",' | |
229 ' "caption": ""},' | |
230 ' ],' | |
231 ' "supported_on": ["chrome.linux:8-"],' | |
232 ' "example_value": ["foo", "bar"]' | |
233 ' },' | |
234 ' ],' | |
235 ' "placeholders": [],' | |
236 ' "messages": {},' | |
237 '}') | |
238 output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'reg', 'en') | |
239 expected_output = self.NEWLINE.join([ | |
240 'Windows Registry Editor Version 5.00', | |
241 '', | |
242 '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Chromium\\ListPolicy]', | |
243 '"1"="foo"', | |
244 '"2"="bar"']) | |
245 | |
215 def testDictionaryPolicy(self): | 246 def testDictionaryPolicy(self): |
216 # Tests a policy group with a single policy of type 'dict'. | 247 # Tests a policy group with a single policy of type 'dict'. |
217 example = { | 248 example = { |
218 'bool': True, | 249 'bool': True, |
219 'dict': { | 250 'dict': { |
220 'a': 1, | 251 'a': 1, |
221 'b': 2, | 252 'b': 2, |
222 }, | 253 }, |
223 'int': 10, | 254 'int': 10, |
224 'list': [1, 2, 3], | 255 'list': [1, 2, 3], |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 '"Policy2"="c"', | 340 '"Policy2"="c"', |
310 '', | 341 '', |
311 '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Chromium\\Policy1]', | 342 '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Chromium\\Policy1]', |
312 '"1"="a"', | 343 '"1"="a"', |
313 '"2"="b"']) | 344 '"2"="b"']) |
314 self.CompareOutputs(output, expected_output) | 345 self.CompareOutputs(output, expected_output) |
315 | 346 |
316 | 347 |
317 if __name__ == '__main__': | 348 if __name__ == '__main__': |
318 unittest.main() | 349 unittest.main() |
OLD | NEW |