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 | 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 testEmptyVersion(self): | |
|
pastarmovj
2014/10/07 14:54:35
Actually I think a better name for this test will
cschuet1
2014/10/07 15:42:45
Done.
| |
| 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--><displ ayName/><description/>' | |
| 88 '<resources><stringTable><string id="SUPPORTED_TESTOS">Supported on' | |
| 89 ' Test OS or higher</string></stringTable><presentationTable/>' | |
| 90 '</resources></policyDefinitionResources>') | |
| 91 self.AssertXMLEquals(output, expected_output) | |
| 92 | |
| 80 def testPolicyGroup(self): | 93 def testPolicyGroup(self): |
| 81 empty_policy_group = { | 94 empty_policy_group = { |
| 82 'name': 'PolicyGroup', | 95 'name': 'PolicyGroup', |
| 83 'caption': 'Test Group Caption', | 96 'caption': 'Test Group Caption', |
| 84 'desc': 'This is the test description of the test policy group.', | 97 'desc': 'This is the test description of the test policy group.', |
| 85 'policies': [ | 98 'policies': [ |
| 86 {'name': 'PolicyStub2', | 99 {'name': 'PolicyStub2', |
| 87 'type': 'main'}, | 100 'type': 'main'}, |
| 88 {'name': 'PolicyStub1', | 101 {'name': 'PolicyStub1', |
| 89 'type': 'main'}, | 102 'type': 'main'}, |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 })) | 371 })) |
| 359 self.assertFalse(self.writer.IsPolicySupported({ | 372 self.assertFalse(self.writer.IsPolicySupported({ |
| 360 'supported_on': [ | 373 'supported_on': [ |
| 361 {'platforms': ['mac', 'linux']}, {'platforms': ['aaa']} | 374 {'platforms': ['mac', 'linux']}, {'platforms': ['aaa']} |
| 362 ] | 375 ] |
| 363 })) | 376 })) |
| 364 | 377 |
| 365 | 378 |
| 366 if __name__ == '__main__': | 379 if __name__ == '__main__': |
| 367 unittest.main() | 380 unittest.main() |
| OLD | NEW |