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

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

Issue 544113002: Add optional mandatory policy setting for template generation (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: rebase Created 6 years, 3 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
diff --git a/grit/format/policy_templates/writers/plist_writer_unittest.py b/grit/format/policy_templates/writers/plist_writer_unittest.py
index f76db733c4e19669cfe20356513d45b81a204cd4..ddbdbfe500562d545740ca7322790982965d4591 100644
--- a/grit/format/policy_templates/writers/plist_writer_unittest.py
+++ b/grit/format/policy_templates/writers/plist_writer_unittest.py
@@ -118,6 +118,108 @@ class PListWriterUnittest(writer_unittest_common.WriterUnittestCommon):
</array>''')
self.assertEquals(output.strip(), expected_output.strip())
+ def testRecommendedPolicy(self):
+ # Tests a policy group with a single policy of type 'main'.
+ grd = self.PrepareTest('''
+ {
+ 'policy_definitions': [
+ {
+ 'name': 'MainGroup',
+ 'type': 'group',
+ 'policies': [{
+ 'name': 'MainPolicy',
+ 'type': 'main',
+ 'desc': '',
+ 'caption': '',
+ 'features': {
+ 'can_be_recommended' : True
+ },
+ 'supported_on': ['chrome.mac:8-'],
+ }],
+ 'desc': '',
+ 'caption': '',
+ },
+ ],
+ 'placeholders': [],
+ 'messages': {}
+ }''')
+ output = self.GetOutput(
+ grd,
+ 'fr',
+ {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
+ 'plist',
+ 'en')
+ expected_output = self._GetExpectedOutputs(
+ 'Chromium', 'com.example.Test', '''<array>
+ <dict>
+ <key>pfm_name</key>
+ <string>MainPolicy</string>
+ <key>pfm_description</key>
+ <string/>
+ <key>pfm_title</key>
+ <string/>
+ <key>pfm_targets</key>
+ <array>
+ <string>user</string>
+ <string>user-managed</string>
+ </array>
+ <key>pfm_type</key>
+ <string>boolean</string>
+ </dict>
+ </array>''')
+ self.assertEquals(output.strip(), expected_output.strip())
+
+ def testRecommendedOnlyPolicy(self):
+ # Tests a policy group with a single policy of type 'main'.
+ grd = self.PrepareTest('''
+ {
+ 'policy_definitions': [
+ {
+ 'name': 'MainGroup',
+ 'type': 'group',
+ 'policies': [{
+ 'name': 'MainPolicy',
+ 'type': 'main',
+ 'desc': '',
+ 'caption': '',
+ 'features': {
+ 'can_be_recommended' : True,
+ 'can_be_mandatory' : False
+ },
+ 'supported_on': ['chrome.mac:8-'],
+ }],
+ 'desc': '',
+ 'caption': '',
+ },
+ ],
+ 'placeholders': [],
+ 'messages': {}
+ }''')
+ output = self.GetOutput(
+ grd,
+ 'fr',
+ {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
+ 'plist',
+ 'en')
+ expected_output = self._GetExpectedOutputs(
+ 'Chromium', 'com.example.Test', '''<array>
+ <dict>
+ <key>pfm_name</key>
+ <string>MainPolicy</string>
+ <key>pfm_description</key>
+ <string/>
+ <key>pfm_title</key>
+ <string/>
+ <key>pfm_targets</key>
+ <array>
+ <string>user</string>
+ </array>
+ <key>pfm_type</key>
+ <string>boolean</string>
+ </dict>
+ </array>''')
+ self.assertEquals(output.strip(), expected_output.strip())
+
def testStringPolicy(self):
# Tests a policy group with a single policy of type 'string'.
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