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

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

Issue 5958014: Policy: Add ProxyMode and deprecate ProxyServerMode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: check final diff Created 9 years, 11 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: tools/grit/grit/format/policy_templates/writers/plist_writer_unittest.py
diff --git a/tools/grit/grit/format/policy_templates/writers/plist_writer_unittest.py b/tools/grit/grit/format/policy_templates/writers/plist_writer_unittest.py
index 88240cd6dca3892fb00ec49d1e2bbb51ca9daf2a..bbb0f52d39064160e7c828d564b9e17d4dc1da4d 100644
--- a/tools/grit/grit/format/policy_templates/writers/plist_writer_unittest.py
+++ b/tools/grit/grit/format/policy_templates/writers/plist_writer_unittest.py
@@ -175,8 +175,8 @@ class PListWriterUnittest(writer_unittest_common.WriterUnittestCommon):
</array>''')
self.assertEquals(output.strip(), expected_output.strip())
- def testEnumPolicy(self):
- # Tests a policy group with a single policy of type 'enum'.
+ def testIntEnumPolicy(self):
+ # Tests a policy group with a single policy of type 'int-enum'.
grd = self.PrepareTest('''
{
'policy_definitions': [
@@ -185,10 +185,10 @@ class PListWriterUnittest(writer_unittest_common.WriterUnittestCommon):
'type': 'group',
'policies': [{
'name': 'EnumPolicy',
- 'type': 'enum',
+ 'type': 'int-enum',
'items': [
- {'name': 'ProxyServerDisabled', 'value': '0'},
- {'name': 'ProxyServerAutoDetect', 'value': '1'},
+ {'name': 'ProxyServerDisabled', 'value': 0},
+ {'name': 'ProxyServerAutoDetect', 'value': 1},
],
'supported_on': ['chrome.mac:8-'],
}],
@@ -235,6 +235,66 @@ class PListWriterUnittest(writer_unittest_common.WriterUnittestCommon):
</array>''')
self.assertEquals(output.strip(), expected_output.strip())
+ def testStringEnumPolicy(self):
+ # Tests a policy group with a single policy of type 'string-enum'.
+ grd = self.PrepareTest('''
+ {
+ 'policy_definitions': [
+ {
+ 'name': 'EnumGroup',
+ 'type': 'group',
+ 'policies': [{
+ 'name': 'EnumPolicy',
+ 'type': 'string-enum',
+ 'items': [
+ {'name': 'ProxyServerDisabled', 'value': 'one'},
+ {'name': 'ProxyServerAutoDetect', 'value': 'two'},
+ ],
+ 'supported_on': ['chrome.mac:8-'],
+ }],
+ },
+ ],
+ 'placeholders': [],
+ }''', '''
+ <messages>
+ <message name="IDS_POLICY_ENUMGROUP_CAPTION">This is not tested here.</message>
+ <message name="IDS_POLICY_ENUMGROUP_DESC">This is not tested here.</message>
+ <message name="IDS_POLICY_ENUMPOLICY_CAPTION">This is not tested here.</message>
+ <message name="IDS_POLICY_ENUMPOLICY_DESC">This is not tested here.</message>
+ <message name="IDS_POLICY_ENUM_PROXYSERVERDISABLED_CAPTION">This is not tested here.</message>
+ <message name="IDS_POLICY_ENUM_PROXYSERVERAUTODETECT_CAPTION">This is not tested here.</message>
+ </messages>
+ ''' )
+ output = self.GetOutput(
+ grd,
+ 'fr',
+ {'_google_chrome': '1', 'mac_bundle_id': 'com.example.Test2'},
+ 'plist',
+ 'en')
+ expected_output = self._GetExpectedOutputs(
+ 'Google_Chrome', 'com.example.Test2', '''<array>
+ <dict>
+ <key>pfm_name</key>
+ <string>EnumPolicy</string>
+ <key>pfm_description</key>
+ <string/>
+ <key>pfm_title</key>
+ <string/>
+ <key>pfm_targets</key>
+ <array>
+ <string>user-managed</string>
+ </array>
+ <key>pfm_type</key>
+ <string>string</string>
+ <key>pfm_range_list</key>
+ <array>
+ <string>one</string>
+ <string>two</string>
+ </array>
+ </dict>
+ </array>''')
+ self.assertEquals(output.strip(), expected_output.strip())
+
def testNonSupportedPolicy(self):
# Tests a policy that is not supported on Mac, so it shouldn't
# be included in the plist file.

Powered by Google App Engine
This is Rietveld 408576698