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 | 6 |
7 """Unittests for grit.format.policy_templates.writers.adml_writer.""" | 7 """Unittests for grit.format.policy_templates.writers.adml_writer.""" |
8 | 8 |
9 | 9 |
10 import os | 10 import os |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 self.writer.EndTemplate() | 70 self.writer.EndTemplate() |
71 output = self.writer.GetTemplateText() | 71 output = self.writer.GetTemplateText() |
72 expected_output = ( | 72 expected_output = ( |
73 '<?xml version="1.0" ?><policyDefinitionResources' | 73 '<?xml version="1.0" ?><policyDefinitionResources' |
74 ' revision="1.0" schemaVersion="1.0"><displayName/><description/>' | 74 ' revision="1.0" schemaVersion="1.0"><displayName/><description/>' |
75 '<resources><stringTable><string id="SUPPORTED_TESTOS">Supported on' | 75 '<resources><stringTable><string id="SUPPORTED_TESTOS">Supported on' |
76 ' Test OS or higher</string></stringTable><presentationTable/>' | 76 ' Test OS or higher</string></stringTable><presentationTable/>' |
77 '</resources></policyDefinitionResources>') | 77 '</resources></policyDefinitionResources>') |
78 self.AssertXMLEquals(output, expected_output) | 78 self.AssertXMLEquals(output, expected_output) |
79 | 79 |
| 80 def testVersionAnnotation(self): |
| 81 self.writer.config['version'] = '39.0.0.0' |
| 82 self.writer.BeginTemplate() |
| 83 self.writer.EndTemplate() |
| 84 output = self.writer.GetTemplateText() |
| 85 expected_output = ( |
| 86 '<?xml version="1.0" ?><policyDefinitionResources' |
| 87 ' revision="1.0" schemaVersion="1.0"><!--test version: 39.0.0.0-->' |
| 88 '<displayName/><description/><resources><stringTable>' |
| 89 '<string id="SUPPORTED_TESTOS">Supported on' |
| 90 ' Test OS or higher</string></stringTable><presentationTable/>' |
| 91 '</resources></policyDefinitionResources>') |
| 92 self.AssertXMLEquals(output, expected_output) |
| 93 |
80 def testPolicyGroup(self): | 94 def testPolicyGroup(self): |
81 empty_policy_group = { | 95 empty_policy_group = { |
82 'name': 'PolicyGroup', | 96 'name': 'PolicyGroup', |
83 'caption': 'Test Group Caption', | 97 'caption': 'Test Group Caption', |
84 'desc': 'This is the test description of the test policy group.', | 98 'desc': 'This is the test description of the test policy group.', |
85 'policies': [ | 99 'policies': [ |
86 {'name': 'PolicyStub2', | 100 {'name': 'PolicyStub2', |
87 'type': 'main'}, | 101 'type': 'main'}, |
88 {'name': 'PolicyStub1', | 102 {'name': 'PolicyStub1', |
89 'type': 'main'}, | 103 'type': 'main'}, |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 })) | 372 })) |
359 self.assertFalse(self.writer.IsPolicySupported({ | 373 self.assertFalse(self.writer.IsPolicySupported({ |
360 'supported_on': [ | 374 'supported_on': [ |
361 {'platforms': ['mac', 'linux']}, {'platforms': ['aaa']} | 375 {'platforms': ['mac', 'linux']}, {'platforms': ['aaa']} |
362 ] | 376 ] |
363 })) | 377 })) |
364 | 378 |
365 | 379 |
366 if __name__ == '__main__': | 380 if __name__ == '__main__': |
367 unittest.main() | 381 unittest.main() |
OLD | NEW |