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

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

Issue 2653823006: Include 'external' policies in grit output (admx, adm, doc etc.) (Closed)
Patch Set: Whitespace fix Created 3 years, 3 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 6
7 """Unittests for writers.admx_writer.""" 7 """Unittests for writers.admx_writer."""
8 8
9 9
10 import os 10 import os
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 ' presentation="$(presentation.SampleDictionaryPolicy)">\n' 540 ' presentation="$(presentation.SampleDictionaryPolicy)">\n'
541 ' <parentCategory ref="PolicyGroup"/>\n' 541 ' <parentCategory ref="PolicyGroup"/>\n'
542 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n' 542 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n'
543 ' <elements>\n' 543 ' <elements>\n'
544 ' <text id="SampleDictionaryPolicy" maxLength="1000000"' 544 ' <text id="SampleDictionaryPolicy" maxLength="1000000"'
545 ' valueName="SampleDictionaryPolicy"/>\n' 545 ' valueName="SampleDictionaryPolicy"/>\n'
546 ' </elements>\n' 546 ' </elements>\n'
547 '</policy>') 547 '</policy>')
548 self.AssertXMLEquals(output, expected_output) 548 self.AssertXMLEquals(output, expected_output)
549 549
550 def testExternalPolicy(self):
551 external_policy = {
552 'name': 'SampleExternalPolicy',
553 'type': 'external',
554 }
555 self._initWriterForPolicy(self.writer, external_policy)
556
557 self.writer.WritePolicy(external_policy)
558 output = self.GetXMLOfChildren(self._GetPoliciesElement(self.writer._doc))
559 expected_output = (
560 '<policy class="' + self.writer.GetClass(external_policy) + '"'
561 ' displayName="$(string.SampleExternalPolicy)"'
562 ' explainText="$(string.SampleExternalPolicy_Explain)"'
563 ' key="Software\\Policies\\' + self._GetKey() + '"'
564 ' name="SampleExternalPolicy"'
565 ' presentation="$(presentation.SampleExternalPolicy)">\n'
566 ' <parentCategory ref="PolicyGroup"/>\n'
567 ' <supportedOn ref="SUPPORTED_TESTOS"/>\n'
568 ' <elements>\n'
569 ' <text id="SampleExternalPolicy" maxLength="1000000"'
570 ' valueName="SampleExternalPolicy"/>\n'
571 ' </elements>\n'
572 '</policy>')
573 self.AssertXMLEquals(output, expected_output)
574
550 def testPlatform(self): 575 def testPlatform(self):
551 # Test that the writer correctly chooses policies of platform Windows. 576 # Test that the writer correctly chooses policies of platform Windows.
552 self.assertTrue(self.writer.IsPolicySupported({ 577 self.assertTrue(self.writer.IsPolicySupported({
553 'supported_on': [ 578 'supported_on': [
554 {'platforms': ['win', 'zzz']}, {'platforms': ['aaa']} 579 {'platforms': ['win', 'zzz']}, {'platforms': ['aaa']}
555 ] 580 ]
556 })) 581 }))
557 self.assertFalse(self.writer.IsPolicySupported({ 582 self.assertFalse(self.writer.IsPolicySupported({
558 'supported_on': [ 583 'supported_on': [
559 {'platforms': ['mac', 'linux']}, {'platforms': ['aaa']} 584 {'platforms': ['mac', 'linux']}, {'platforms': ['aaa']}
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 ' </item>\n' 646 ' </item>\n'
622 ' </enum>\n' 647 ' </enum>\n'
623 ' </elements>\n' 648 ' </elements>\n'
624 ' </policy>\n' 649 ' </policy>\n'
625 '</policyDefinitions>') 650 '</policyDefinitions>')
626 self.AssertXMLEquals(output, expected_output) 651 self.AssertXMLEquals(output, expected_output)
627 652
628 653
629 if __name__ == '__main__': 654 if __name__ == '__main__':
630 unittest.main() 655 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698