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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
545 ''', '''[Strings] | 545 ''', '''[Strings] |
546 SUPPORTED_WINXPSP2="At least Windows 3.15" | 546 SUPPORTED_WINXPSP2="At least Windows 3.15" |
547 chromium="Chromium" | 547 chromium="Chromium" |
548 chromium_recommended="Chromium - Recommended" | 548 chromium_recommended="Chromium - Recommended" |
549 ListPolicy_Policy="Caption of list policy." | 549 ListPolicy_Policy="Caption of list policy." |
550 ListPolicy_Explain="Description of list policy.\\nWith a newline." | 550 ListPolicy_Explain="Description of list policy.\\nWith a newline." |
551 ListPolicy_Part="Label of list policy." | 551 ListPolicy_Part="Label of list policy." |
552 ''') | 552 ''') |
553 self.CompareOutputs(output, expected_output) | 553 self.CompareOutputs(output, expected_output) |
554 | 554 |
555 def testStringEnumListPolicy(self): | |
556 # Tests a policy group with a single policy of type 'list'. | |
Joao da Silva
2014/06/25 16:46:56
string-enum-list
Andrew T Wilson (Slow)
2014/06/26 08:08:56
Done.
| |
557 grd = self.PrepareTest(''' | |
558 { | |
559 'policy_definitions': [ | |
560 { | |
561 'name': 'ListPolicy', | |
562 'type': 'string-enum-list', | |
563 'supported_on': ['chrome.win:8-'], | |
564 'features': { 'can_be_recommended': True }, | |
565 'desc': """Description of list policy. | |
566 With a newline.""", | |
567 'items': [ | |
568 {'name': 'ProxyServerDisabled', 'value': 'one', | |
569 'caption': 'Option1'}, | |
570 {'name': 'ProxyServerAutoDetect', 'value': 'two', | |
571 'caption': 'Option2'}, | |
572 ], | |
573 'caption': 'Caption of list policy.', | |
574 'label': 'Label of list policy.' | |
575 }, | |
576 ], | |
577 'placeholders': [], | |
578 'messages': { | |
579 'win_supported_winxpsp2': { | |
580 'text': 'At least Windows 3.15', 'desc': 'blah' | |
581 }, | |
582 'doc_recommended': { | |
583 'text': 'Recommended', 'desc': 'bleh' | |
584 } | |
585 }, | |
586 }''') | |
587 output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'adm', 'en') | |
588 expected_output = self.ConstructOutput( | |
589 ['MACHINE', 'USER'], ''' | |
590 CATEGORY !!chromium | |
591 KEYNAME "Software\\Policies\\Chromium" | |
592 | |
593 POLICY !!ListPolicy_Policy | |
594 #if version >= 4 | |
595 SUPPORTED !!SUPPORTED_WINXPSP2 | |
596 #endif | |
597 EXPLAIN !!ListPolicy_Explain | |
598 | |
599 PART !!ListPolicy_Part LISTBOX | |
600 KEYNAME "Software\\Policies\\Chromium\\ListPolicy" | |
601 VALUEPREFIX "" | |
602 END PART | |
603 END POLICY | |
604 | |
605 END CATEGORY | |
606 | |
607 CATEGORY !!chromium_recommended | |
608 KEYNAME "Software\\Policies\\Chromium\\Recommended" | |
609 | |
610 POLICY !!ListPolicy_Policy | |
611 #if version >= 4 | |
612 SUPPORTED !!SUPPORTED_WINXPSP2 | |
613 #endif | |
614 EXPLAIN !!ListPolicy_Explain | |
615 | |
616 PART !!ListPolicy_Part LISTBOX | |
617 KEYNAME "Software\\Policies\\Chromium\\Recommended\\ListPolicy" | |
618 VALUEPREFIX "" | |
619 END PART | |
620 END POLICY | |
621 | |
622 END CATEGORY | |
623 | |
624 | |
625 ''', '''[Strings] | |
626 SUPPORTED_WINXPSP2="At least Windows 3.15" | |
627 chromium="Chromium" | |
628 chromium_recommended="Chromium - Recommended" | |
629 ListPolicy_Policy="Caption of list policy." | |
630 ListPolicy_Explain="Description of list policy.\\nWith a newline." | |
631 ListPolicy_Part="Label of list policy." | |
632 ''') | |
633 self.CompareOutputs(output, expected_output) | |
634 | |
555 def testDictionaryPolicy(self): | 635 def testDictionaryPolicy(self): |
556 # Tests a policy group with a single policy of type 'dict'. | 636 # Tests a policy group with a single policy of type 'dict'. |
557 grd = self.PrepareTest(''' | 637 grd = self.PrepareTest(''' |
558 { | 638 { |
559 'policy_definitions': [ | 639 'policy_definitions': [ |
560 { | 640 { |
561 'name': 'DictionaryPolicy', | 641 'name': 'DictionaryPolicy', |
562 'type': 'dict', | 642 'type': 'dict', |
563 'supported_on': ['chrome.win:8-'], | 643 'supported_on': ['chrome.win:8-'], |
564 'features': { 'can_be_recommended': True }, | 644 'features': { 'can_be_recommended': True }, |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
835 Policy1_Explain="Description of policy1.\\nWith a newline." | 915 Policy1_Explain="Description of policy1.\\nWith a newline." |
836 Policy1_Part="Caption of policy1." | 916 Policy1_Part="Caption of policy1." |
837 Policy2_Policy="Caption of policy2." | 917 Policy2_Policy="Caption of policy2." |
838 Policy2_Explain="Description of policy2.\\nWith a newline." | 918 Policy2_Explain="Description of policy2.\\nWith a newline." |
839 Policy2_Part="Caption of policy2." | 919 Policy2_Part="Caption of policy2." |
840 ''') | 920 ''') |
841 self.CompareOutputs(output, expected_output) | 921 self.CompareOutputs(output, expected_output) |
842 | 922 |
843 if __name__ == '__main__': | 923 if __name__ == '__main__': |
844 unittest.main() | 924 unittest.main() |
OLD | NEW |