Chromium Code Reviews| 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 testEmptyVersion(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'}, 'adm', 'en') | |
|
pastarmovj
2014/10/07 14:54:35
nit: Line too long.
cschuet1
2014/10/07 15:42:45
Done.
| |
| 95 expected_output = '''; chromium version: 39.0.0.0\n''' + self.ConstructOutpu t( | |
|
pastarmovj
2014/10/07 14:54:35
Ditto.
cschuet1
2014/10/07 15:42:45
Done.
| |
| 96 ['MACHINE', 'USER'], ''' | |
| 97 CATEGORY !!chromium | |
| 98 KEYNAME "Software\\Policies\\Chromium" | |
| 99 | |
| 100 END CATEGORY | |
| 101 | |
| 102 CATEGORY !!chromium_recommended | |
| 103 KEYNAME "Software\\Policies\\Chromium\\Recommended" | |
| 104 | |
| 105 END CATEGORY | |
| 106 | |
| 107 | |
| 108 ''', '''[Strings] | |
| 109 SUPPORTED_WINXPSP2="At least "Windows 3.11" | |
| 110 chromium="Chromium" | |
| 111 chromium_recommended="Chromium - Recommended"''') | |
| 112 self.CompareOutputs(output, expected_output) | |
| 113 | |
| 79 def testMainPolicy(self): | 114 def testMainPolicy(self): |
| 80 # Tests a policy group with a single policy of type 'main'. | 115 # Tests a policy group with a single policy of type 'main'. |
| 81 grd = self.PrepareTest(''' | 116 grd = self.PrepareTest(''' |
| 82 { | 117 { |
| 83 'policy_definitions': [ | 118 'policy_definitions': [ |
| 84 { | 119 { |
| 85 'name': 'MainPolicy', | 120 'name': 'MainPolicy', |
| 86 'type': 'main', | 121 'type': 'main', |
| 87 'supported_on': ['chrome.win:8-'], | 122 'supported_on': ['chrome.win:8-'], |
| 88 'features': { 'can_be_recommended': True }, | 123 '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." | 1014 Policy1_Explain="Description of policy1.\\nWith a newline." |
| 980 Policy1_Part="Caption of policy1." | 1015 Policy1_Part="Caption of policy1." |
| 981 Policy2_Policy="Caption of policy2." | 1016 Policy2_Policy="Caption of policy2." |
| 982 Policy2_Explain="Description of policy2.\\nWith a newline." | 1017 Policy2_Explain="Description of policy2.\\nWith a newline." |
| 983 Policy2_Part="Caption of policy2." | 1018 Policy2_Part="Caption of policy2." |
| 984 ''') | 1019 ''') |
| 985 self.CompareOutputs(output, expected_output) | 1020 self.CompareOutputs(output, expected_output) |
| 986 | 1021 |
| 987 if __name__ == '__main__': | 1022 if __name__ == '__main__': |
| 988 unittest.main() | 1023 unittest.main() |
| OLD | NEW |