| Index: grit/format/policy_templates/writers/ios_plist_writer_unittest.py
|
| ===================================================================
|
| --- grit/format/policy_templates/writers/ios_plist_writer_unittest.py (revision 177)
|
| +++ grit/format/policy_templates/writers/ios_plist_writer_unittest.py (working copy)
|
| @@ -54,12 +54,18 @@
|
| templates,
|
| expected_output,
|
| parse,
|
| - decode_and_parse):
|
| + decode_and_parse,
|
| + defines=None):
|
| +
|
| + _defines = { '_chromium': '1',
|
| + 'mac_bundle_id': 'com.example.Test',
|
| + 'version': '39.0.0.0' }
|
| +
|
| # Generate the grit output for |templates|.
|
| output = self.GetOutput(
|
| self.PrepareTest(templates),
|
| 'fr',
|
| - { '_chromium': '1', 'mac_bundle_id': 'com.example.Test' },
|
| + _defines,
|
| 'ios_plist',
|
| 'en')
|
|
|
| @@ -80,12 +86,12 @@
|
| decoded_chrome_policy = decode_and_parse(encoded_chrome_policy)
|
| self.assertEquals(decoded_chrome_policy, expected_output)
|
|
|
| - def _VerifyGeneratedOutput(self, templates, expected):
|
| + def _VerifyGeneratedOutput(self, templates, expected, defines=None):
|
| # plistlib is available on all Python platforms.
|
| parse = functools.partial(self._ParseWithPython, False)
|
| decode_and_parse = functools.partial(self._ParseWithPython, True)
|
| self._VerifyGeneratedOutputWithParsers(
|
| - templates, expected, parse, decode_and_parse)
|
| + templates, expected, parse, decode_and_parse, defines)
|
|
|
| # The Cocoa bindings are available on Mac OS X only.
|
| if Cocoa:
|
| @@ -92,7 +98,7 @@
|
| parse = functools.partial(self._ParseWithCocoa, False)
|
| decode_and_parse = functools.partial(self._ParseWithCocoa, True)
|
| self._VerifyGeneratedOutputWithParsers(
|
| - templates, expected, parse, decode_and_parse)
|
| + templates, expected, parse, decode_and_parse, defines)
|
|
|
| def _MakeTemplate(self, name, type, example, extra=''):
|
| return '''
|
| @@ -124,6 +130,17 @@
|
| expected = {}
|
| self._VerifyGeneratedOutput(templates, expected)
|
|
|
| + def testEmptyVersion(self):
|
| + templates = '''
|
| + {
|
| + 'policy_definitions': [],
|
| + 'placeholders': [],
|
| + 'messages': {},
|
| + }
|
| + '''
|
| + expected = {}
|
| + self._VerifyGeneratedOutput(templates, expected)
|
| +
|
| def testBoolean(self):
|
| templates = self._MakeTemplate('BooleanPolicy', 'main', 'True')
|
| expected = {
|
|
|