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

Unified Diff: tools/grit/grit/format/policy_templates/writers/plist_strings_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_strings_writer_unittest.py
diff --git a/tools/grit/grit/format/policy_templates/writers/plist_strings_writer_unittest.py b/tools/grit/grit/format/policy_templates/writers/plist_strings_writer_unittest.py
index 1fc19c8a144852a540557a882fc020ea9bf0932d..f921c1693b14222f66e288b2a57c0905736d6b72 100644
--- a/tools/grit/grit/format/policy_templates/writers/plist_strings_writer_unittest.py
+++ b/tools/grit/grit/format/policy_templates/writers/plist_strings_writer_unittest.py
@@ -126,8 +126,8 @@ With a newline.</message>
'"Description of policy.\\nWith a newline.";')
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': [
@@ -136,10 +136,10 @@ With a newline.</message>
'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-'],
}],
@@ -172,6 +172,52 @@ With a newline.</message>
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">Caption of group.</message>
+ <message name="IDS_POLICY_ENUMGROUP_DESC">Description of group.</message>
+ <message name="IDS_POLICY_ENUMPOLICY_CAPTION">Caption of policy.</message>
+ <message name="IDS_POLICY_ENUMPOLICY_DESC">Description of policy.</message>
+ <message name="IDS_POLICY_ENUM_PROXYSERVERDISABLED_CAPTION">Option1</message>
+ <message name="IDS_POLICY_ENUM_PROXYSERVERAUTODETECT_CAPTION">Option2</message>
+ <message name="IDS_POLICY_MAC_CHROME_PREFERENCES">$1 preferences</message>
+ </messages>
+ ''' )
+ output = self.GetOutput(
+ grd,
+ 'fr',
+ {'_google_chrome': '1', 'mac_bundle_id': 'com.example.Test2'},
+ 'plist_strings',
+ 'en')
+ expected_output = (
+ 'Google_Chrome.pfm_title = "Google Chrome";\n'
+ 'Google_Chrome.pfm_description = "Google Chrome preferences";\n'
+ 'EnumPolicy.pfm_title = "Caption of policy.";\n'
+ 'EnumPolicy.pfm_description = '
+ '"one - Option1\\ntwo - Option2\\nDescription of policy.";\n')
+
+ self.assertEquals(output.strip(), expected_output.strip())
+
def testNonSupportedPolicy(self):
# Tests a policy that is not supported on Mac, so its strings shouldn't
# be included in the plist string table.

Powered by Google App Engine
This is Rietveld 408576698