Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: grit/format/policy_templates/writers/plist_writer_unittest.py

Issue 631223003: Include chromium version number in policy templates (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: grit/format/policy_templates/writers/plist_writer_unittest.py
===================================================================
--- grit/format/policy_templates/writers/plist_writer_unittest.py (revision 177)
+++ grit/format/policy_templates/writers/plist_writer_unittest.py (working copy)
@@ -52,6 +52,41 @@
</dict>
</plist>''' % (product_name, bundle_id, policies)
+ def _GetExpectedOutputsWithVersion(self, product_name, bundle_id, policies,
+ version):
+ '''Substitutes the variable parts into a plist template. The result
+ of this function can be used as an expected result to test the output
+ of PListWriter.
+
+ Args:
+ product_name: The name of the product, normally Chromium or Google Chrome.
+ bundle_id: The mac bundle id of the product.
+ policies: The list of policies.
+
+ Returns:
+ The text of a plist template with the variable parts substituted.
+ '''
+ return '''
+<?xml version="1.0" ?>
+<!DOCTYPE plist PUBLIC '-//Apple//DTD PLIST 1.0//EN' 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'>
+<plist version="1">
+ <dict>
+ <key>pfm_name</key>
+ <string>%s</string>
+ <key>pfm_description</key>
+ <string/>
+ <key>pfm_title</key>
+ <string/>
+ <key>pfm_version</key>
+ <string>1</string>
+ <key>pfm_domain</key>
+ <string>%s</string>
+ <key>pfm_subkeys</key>
+ %s
+ </dict>
+ <!--%s-->
+</plist>''' % (product_name, bundle_id, policies, version)
+
def testEmpty(self):
# Test PListWriter in case of empty polices.
grd = self.PrepareTest('''
@@ -71,6 +106,30 @@
'Chromium', 'com.example.Test', '<array/>')
self.assertEquals(output.strip(), expected_output.strip())
+ def testEmptyVersion(self):
+ # Test PListWriter in case of empty polices.
+ grd = self.PrepareTest('''
+ {
+ 'policy_definitions': [],
+ 'placeholders': [],
+ 'messages': {},
+ }''')
+
+ output = self.GetOutput(
+ grd,
+ 'fr',
+ {'_chromium': '1',
+ 'mac_bundle_id': 'com.example.Test',
+ 'version': '39.0.0.0'},
+ 'plist',
+ 'en')
+ expected_output = self._GetExpectedOutputsWithVersion(
+ 'Chromium',
+ 'com.example.Test',
+ '<array/>',
+ 'chromium version: 39.0.0.0')
+ self.assertEquals(output.strip(), expected_output.strip())
+
def testMainPolicy(self):
# Tests a policy group with a single policy of type 'main'.
grd = self.PrepareTest('''
« no previous file with comments | « grit/format/policy_templates/writers/plist_writer.py ('k') | grit/format/policy_templates/writers/reg_writer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698