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

Side by Side Diff: grit/format/policy_templates/writers/adm_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 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 END CATEGORY 70 END CATEGORY
71 71
72 72
73 ''', '''[Strings] 73 ''', '''[Strings]
74 SUPPORTED_WINXPSP2="At least "Windows 3.11" 74 SUPPORTED_WINXPSP2="At least "Windows 3.11"
75 chromium="Chromium" 75 chromium="Chromium"
76 chromium_recommended="Chromium - Recommended"''') 76 chromium_recommended="Chromium - Recommended"''')
77 self.CompareOutputs(output, expected_output) 77 self.CompareOutputs(output, expected_output)
78 78
79 def testVersionAnnotation(self):
80 # Test PListWriter in case of empty polices.
81 grd = self.PrepareTest('''
82 {
83 'policy_definitions': [],
84 'placeholders': [],
85 'messages': {
86 'win_supported_winxpsp2': {
87 'text': 'At least "Windows 3.11', 'desc': 'blah'
88 },
89 'doc_recommended': {
90 'text': 'Recommended', 'desc': 'bleh'
91 }
92 }
93 }''')
94 output = self.GetOutput(
95 grd, 'fr', {'_chromium': '1', 'version':'39.0.0.0'}, 'adm', 'en')
96 expected_output = '; chromium version: 39.0.0.0\n' + \
97 self.ConstructOutput(['MACHINE', 'USER'], '''
98 CATEGORY !!chromium
99 KEYNAME "Software\\Policies\\Chromium"
100
101 END CATEGORY
102
103 CATEGORY !!chromium_recommended
104 KEYNAME "Software\\Policies\\Chromium\\Recommended"
105
106 END CATEGORY
107
108
109 ''', '''[Strings]
110 SUPPORTED_WINXPSP2="At least "Windows 3.11"
111 chromium="Chromium"
112 chromium_recommended="Chromium - Recommended"''')
113 self.CompareOutputs(output, expected_output)
114
79 def testMainPolicy(self): 115 def testMainPolicy(self):
80 # Tests a policy group with a single policy of type 'main'. 116 # Tests a policy group with a single policy of type 'main'.
81 grd = self.PrepareTest(''' 117 grd = self.PrepareTest('''
82 { 118 {
83 'policy_definitions': [ 119 'policy_definitions': [
84 { 120 {
85 'name': 'MainPolicy', 121 'name': 'MainPolicy',
86 'type': 'main', 122 'type': 'main',
87 'supported_on': ['chrome.win:8-'], 123 'supported_on': ['chrome.win:8-'],
88 'features': { 'can_be_recommended': True }, 124 'features': { 'can_be_recommended': True },
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 Policy1_Explain="Description of policy1.\\nWith a newline." 1015 Policy1_Explain="Description of policy1.\\nWith a newline."
980 Policy1_Part="Caption of policy1." 1016 Policy1_Part="Caption of policy1."
981 Policy2_Policy="Caption of policy2." 1017 Policy2_Policy="Caption of policy2."
982 Policy2_Explain="Description of policy2.\\nWith a newline." 1018 Policy2_Explain="Description of policy2.\\nWith a newline."
983 Policy2_Part="Caption of policy2." 1019 Policy2_Part="Caption of policy2."
984 ''') 1020 ''')
985 self.CompareOutputs(output, expected_output) 1021 self.CompareOutputs(output, expected_output)
986 1022
987 if __name__ == '__main__': 1023 if __name__ == '__main__':
988 unittest.main() 1024 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