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

Unified Diff: tools/grit/grit/format/policy_templates/writers/reg_writer_unittest.py

Issue 6176005: Support int-typed policies in policy template generator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: tools/grit/grit/format/policy_templates/writers/reg_writer_unittest.py
diff --git a/tools/grit/grit/format/policy_templates/writers/reg_writer_unittest.py b/tools/grit/grit/format/policy_templates/writers/reg_writer_unittest.py
index 2e30778264f93eada3e52ab7d8cf95c0635593c9..99b8eec682eba37a4a7c917430c1a05c2a95e05e 100644
--- a/tools/grit/grit/format/policy_templates/writers/reg_writer_unittest.py
+++ b/tools/grit/grit/format/policy_templates/writers/reg_writer_unittest.py
@@ -1,5 +1,5 @@
#!/usr/bin/python2.4
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -20,7 +20,7 @@ from grit.format.policy_templates.writers import writer_unittest_common
class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon):
'''Unit tests for RegWriter.'''
- NEWLINE='\r\n'
+ NEWLINE = '\r\n'
def CompareOutputs(self, output, expected_output):
'''Compares the output of the reg_writer with its expected output.
@@ -43,7 +43,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "policy_definitions": [],'
' "placeholders": [],'
'}', '<messages></messages>')
- output = self.GetOutput(grd, 'fr', {'_chromium': '1',}, 'reg', 'en')
+ output = self.GetOutput(grd, 'fr', {'_chromium': '1', }, 'reg', 'en')
expected_output = 'Windows Registry Editor Version 5.00'
self.CompareOutputs(output, expected_output)
@@ -103,6 +103,34 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon):
'"StringPolicy"="hello, world! \\\" \\\\"'])
self.CompareOutputs(output, expected_output)
+ def testIntPolicy(self):
+ # Tests a policy group with a single policy of type 'int'.
+ grd = self.PrepareTest(
+ '{'
+ ' "policy_definitions": ['
+ ' {'
+ ' "name": "IntPolicy",'
+ ' "type": "int",'
+ ' "supported_on": ["chrome.win:8-"],'
+ ' "annotations": {'
+ ' "example_value": 5'
+ ' }'
+ ' },'
+ ' ],'
+ ' "placeholders": [],'
+ '}',
+ '<messages>'
+ ' <message name="IDS_POLICY_INTPOLICY_CAPTION"></message>'
+ ' <message name="IDS_POLICY_INTPOLICY_DESC"></message>'
+ '</messages>')
+ output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'reg', 'en')
+ expected_output = self.NEWLINE.join([
+ 'Windows Registry Editor Version 5.00',
+ '',
+ '[HKEY_LOCAL_MACHINE\\Software\\Policies\\Chromium]',
+ '"IntPolicy"=dword:5'])
+ self.CompareOutputs(output, expected_output)
+
def testIntEnumPolicy(self):
# Tests a policy group with a single policy of type 'int-enum'.
grd = self.PrepareTest(

Powered by Google App Engine
This is Rietveld 408576698