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

Side by Side Diff: grit/format/policy_templates/writers/adm_writer_unittest.py

Issue 702793003: Fix duplicated strings in ADMX templates. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 '''Unit tests for grit.format.policy_templates.writers.adm_writer''' 6 '''Unit tests for grit.format.policy_templates.writers.adm_writer'''
7 7
8 8
9 import os 9 import os
10 import sys 10 import sys
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 Group1_Category="Caption of group." 1013 Group1_Category="Caption of group."
1014 Policy1_Policy="Caption of policy1." 1014 Policy1_Policy="Caption of policy1."
1015 Policy1_Explain="Description of policy1.\\nWith a newline." 1015 Policy1_Explain="Description of policy1.\\nWith a newline."
1016 Policy1_Part="Caption of policy1." 1016 Policy1_Part="Caption of policy1."
1017 Policy2_Policy="Caption of policy2." 1017 Policy2_Policy="Caption of policy2."
1018 Policy2_Explain="Description of policy2.\\nWith a newline." 1018 Policy2_Explain="Description of policy2.\\nWith a newline."
1019 Policy2_Part="Caption of policy2." 1019 Policy2_Part="Caption of policy2."
1020 ''') 1020 ''')
1021 self.CompareOutputs(output, expected_output) 1021 self.CompareOutputs(output, expected_output)
1022 1022
1023 def testDuplicatedStringEnumPolicy(self):
1024 # Verifies that duplicated enum constants get merged, and that
1025 # string constants get escaped.
1026 grd = self.PrepareTest('''
1027 {
1028 'policy_definitions': [
1029 {
1030 'name': 'EnumPolicy.A',
1031 'type': 'string-enum',
1032 'caption': 'Caption of policy A.',
1033 'desc': 'Description of policy A.',
1034 'items': [
1035 {'name': 'tls1.2', 'value': 'tls1.2', 'caption': 'tls1.2' },
1036 ],
1037 'supported_on': ['chrome.win:39-'],
1038 },
1039 {
1040 'name': 'EnumPolicy.B',
1041 'type': 'string-enum',
1042 'caption': 'Caption of policy B.',
1043 'desc': 'Description of policy B.',
1044 'items': [
1045 {'name': 'tls1.2', 'value': 'tls1.2', 'caption': 'tls1.2' },
1046 ],
1047 'supported_on': ['chrome.win:39-'],
1048 },
1049 ],
1050 'placeholders': [],
1051 'messages': {
1052 'win_supported_winxpsp2': {
1053 'text': 'At least Windows 3.14', 'desc': 'blah'
1054 },
1055 'doc_recommended': {
1056 'text': 'Recommended', 'desc': 'bleh'
1057 }
1058 }
1059 }''')
1060 output = self.GetOutput(grd, 'fr', {'_google_chrome': '1'}, 'adm', 'en')
1061 expected_output = self.ConstructOutput(
1062 ['MACHINE', 'USER'], '''
1063 CATEGORY !!google
1064 CATEGORY !!googlechrome
1065 KEYNAME "Software\\Policies\\Google\\Chrome"
1066
1067 POLICY !!EnumPolicy_A_Policy
1068 #if version >= 4
1069 SUPPORTED !!SUPPORTED_WINXPSP2
1070 #endif
1071 EXPLAIN !!EnumPolicy_A_Explain
1072
1073 PART !!EnumPolicy_A_Part DROPDOWNLIST
1074 VALUENAME "EnumPolicy.A"
1075 ITEMLIST
1076 NAME !!tls1_2_DropDown VALUE "tls1.2"
1077 END ITEMLIST
1078 END PART
1079 END POLICY
1080
1081 POLICY !!EnumPolicy_B_Policy
1082 #if version >= 4
1083 SUPPORTED !!SUPPORTED_WINXPSP2
1084 #endif
1085 EXPLAIN !!EnumPolicy_B_Explain
1086
1087 PART !!EnumPolicy_B_Part DROPDOWNLIST
1088 VALUENAME "EnumPolicy.B"
1089 ITEMLIST
1090 NAME !!tls1_2_DropDown VALUE "tls1.2"
1091 END ITEMLIST
1092 END PART
1093 END POLICY
1094
1095 END CATEGORY
1096 END CATEGORY
1097
1098 CATEGORY !!google
1099 CATEGORY !!googlechrome_recommended
1100 KEYNAME "Software\\Policies\\Google\\Chrome\\Recommended"
1101
1102 END CATEGORY
1103 END CATEGORY
1104
1105
1106 ''', '''[Strings]
1107 SUPPORTED_WINXPSP2="At least Windows 3.14"
1108 google="Google"
1109 googlechrome="Google Chrome"
1110 googlechrome_recommended="Google Chrome - Recommended"
1111 EnumPolicy_A_Policy="Caption of policy A."
1112 EnumPolicy_A_Explain="Description of policy A."
1113 EnumPolicy_A_Part="Caption of policy A."
1114 tls1_2_DropDown="tls1.2"
1115 EnumPolicy_B_Policy="Caption of policy B."
1116 EnumPolicy_B_Explain="Description of policy B."
1117 EnumPolicy_B_Part="Caption of policy B."
1118 ''')
1119 self.CompareOutputs(output, expected_output)
1120
1023 if __name__ == '__main__': 1121 if __name__ == '__main__':
1024 unittest.main() 1122 unittest.main()
OLDNEW
« no previous file with comments | « grit/format/policy_templates/writers/adm_writer.py ('k') | grit/format/policy_templates/writers/adml_writer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698