Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: components/policy/tools/template_writers/writers/plist_writer_unittest.py

Issue 2653823006: Include 'external' policies in grit output (admx, adm, doc etc.) (Closed)
Patch Set: Whitespace fix Created 3 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 writers.plist_writer''' 6 '''Unit tests for writers.plist_writer'''
7 7
8 8
9 import os 9 import os
10 import sys 10 import sys
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 <key>pfm_targets</key> 622 <key>pfm_targets</key>
623 <array> 623 <array>
624 <string>user-managed</string> 624 <string>user-managed</string>
625 </array> 625 </array>
626 <key>pfm_type</key> 626 <key>pfm_type</key>
627 <string>dictionary</string> 627 <string>dictionary</string>
628 </dict> 628 </dict>
629 </array>''') 629 </array>''')
630 self.assertEquals(output.strip(), expected_output.strip()) 630 self.assertEquals(output.strip(), expected_output.strip())
631 631
632 def testExternalPolicy(self):
633 # Tests a policy group with a single policy of type 'dict'.
634 policy_json = '''
635 {
636 'policy_definitions': [
637 {
638 'name': 'ExternalGroup',
639 'type': 'group',
640 'desc': '',
641 'caption': '',
642 'policies': [{
643 'name': 'ExternalPolicy',
644 'type': 'external',
645 'supported_on': ['chrome.mac:8-'],
646 'desc': '',
647 'caption': '',
648 }],
649 },
650 ],
651 'placeholders': [],
652 'messages': {},
653 }'''
654 output = self.GetOutput(
655 policy_json,
656 {'_chromium' : '1', 'mac_bundle_id': 'com.example.Test'},
657 'plist')
658 expected_output = self._GetExpectedOutputs(
659 'Chromium', 'com.example.Test', '''<array>
660 <dict>
661 <key>pfm_name</key>
662 <string>ExternalPolicy</string>
663 <key>pfm_description</key>
664 <string/>
665 <key>pfm_title</key>
666 <string/>
667 <key>pfm_targets</key>
668 <array>
669 <string>user-managed</string>
670 </array>
671 <key>pfm_type</key>
672 <string>dictionary</string>
673 </dict>
674 </array>''')
675 self.assertEquals(output.strip(), expected_output.strip())
676
632 def testNonSupportedPolicy(self): 677 def testNonSupportedPolicy(self):
633 # Tests a policy that is not supported on Mac, so it shouldn't 678 # Tests a policy that is not supported on Mac, so it shouldn't
634 # be included in the plist file. 679 # be included in the plist file.
635 policy_json = ''' 680 policy_json = '''
636 { 681 {
637 'policy_definitions': [ 682 'policy_definitions': [
638 { 683 {
639 'name': 'NonMacGroup', 684 'name': 'NonMacGroup',
640 'type': 'group', 685 'type': 'group',
641 'caption': '', 686 'caption': '',
(...skipping 14 matching lines...) Expand all
656 policy_json, 701 policy_json,
657 {'_google_chrome': '1', 'mac_bundle_id': 'com.example.Test2'}, 702 {'_google_chrome': '1', 'mac_bundle_id': 'com.example.Test2'},
658 'plist') 703 'plist')
659 expected_output = self._GetExpectedOutputs( 704 expected_output = self._GetExpectedOutputs(
660 'Google_Chrome', 'com.example.Test2', '''<array/>''') 705 'Google_Chrome', 'com.example.Test2', '''<array/>''')
661 self.assertEquals(output.strip(), expected_output.strip()) 706 self.assertEquals(output.strip(), expected_output.strip())
662 707
663 708
664 if __name__ == '__main__': 709 if __name__ == '__main__':
665 unittest.main() 710 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698