OLD | NEW |
---|---|
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 Loading... | |
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(grd, 'fr', {'_chromium': '1', 'version':'39.0.0.0'}, | |
pastarmovj
2014/10/07 15:47:16
Move all params to the new line.
cschuet1
2014/10/07 16:00:23
Done.
| |
95 'adm', 'en') | |
96 expected_output = '; chromium version: 39.0.0.0\n' +\ | |
pastarmovj
2014/10/07 15:47:16
A space after +.
cschuet1
2014/10/07 16:00:23
Done.
| |
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 Loading... | |
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() |
OLD | NEW |