| OLD | NEW |
| 1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 |
| 11 import sys | 11 import sys |
| 12 import unittest | 12 import unittest |
| 13 if __name__ == '__main__': | 13 if __name__ == '__main__': |
| 14 sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '../../../..')) | 14 sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '../../../..')) |
| 15 | 15 |
| 16 | 16 |
| 17 from grit.format.policy_templates.writers import adml_writer | 17 from grit.format.policy_templates.writers import adml_writer |
| 18 from grit.format.policy_templates.writers import xml_writer_base_unittest | 18 from grit.format.policy_templates.writers import xml_writer_base_unittest |
| 19 from xml.dom import minidom | 19 from xml.dom import minidom |
| 20 | 20 |
| 21 | 21 |
| 22 class AdmlWriterTest(xml_writer_base_unittest.XmlWriterBaseTest): | 22 class AdmlWriterTest(xml_writer_base_unittest.XmlWriterBaseTest): |
| 23 | 23 |
| 24 def setUp(self): | 24 def setUp(self): |
| 25 config = { | 25 config = { |
| 26 'build': 'test', | 26 'build': 'test', |
| 27 'win_supported_os': 'SUPPORTED_TESTOS', | 27 'win_supported_os': 'SUPPORTED_TESTOS', |
| 28 'win_supported_os_msg': 'IDS_POLICY_WIN_SUPPORTED_WINXPSP2', | |
| 29 } | 28 } |
| 30 # Grid messages | 29 self.writer = adml_writer.GetWriter(config) |
| 31 messages = { | 30 self.writer.messages = { |
| 32 'IDS_POLICY_WIN_SUPPORTED_WINXPSP2': 'Supported on Test OS or higher' | 31 'win_supported_winxpsp2': { |
| 32 'text': 'Supported on Test OS or higher', |
| 33 'desc': 'blah' |
| 34 } |
| 33 } | 35 } |
| 34 self.writer = adml_writer.GetWriter(config, messages) | |
| 35 self.writer.Init() | 36 self.writer.Init() |
| 36 | 37 |
| 37 def _InitWriterForAddingPolicyGroups(self, writer): | 38 def _InitWriterForAddingPolicyGroups(self, writer): |
| 38 '''Initialize the writer for adding policy groups. This method must be | 39 '''Initialize the writer for adding policy groups. This method must be |
| 39 called before the method "BeginPolicyGroup" can be called. It initializes | 40 called before the method "BeginPolicyGroup" can be called. It initializes |
| 40 attributes of the writer. | 41 attributes of the writer. |
| 41 ''' | 42 ''' |
| 42 writer.BeginTemplate() | 43 writer.BeginTemplate() |
| 43 | 44 |
| 44 def _InitWriterForAddingPolicies(self, writer, policy): | 45 def _InitWriterForAddingPolicies(self, writer, policy): |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 })) | 329 })) |
| 329 self.assertFalse(self.writer.IsPolicySupported({ | 330 self.assertFalse(self.writer.IsPolicySupported({ |
| 330 'supported_on': [ | 331 'supported_on': [ |
| 331 {'platforms': ['mac', 'linux']}, {'platforms': ['aaa']} | 332 {'platforms': ['mac', 'linux']}, {'platforms': ['aaa']} |
| 332 ] | 333 ] |
| 333 })) | 334 })) |
| 334 | 335 |
| 335 | 336 |
| 336 if __name__ == '__main__': | 337 if __name__ == '__main__': |
| 337 unittest.main() | 338 unittest.main() |
| OLD | NEW |