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

Unified Diff: tools/grit/grit/format/policy_templates/writers/json_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: address comment 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/json_writer_unittest.py
diff --git a/tools/grit/grit/format/policy_templates/writers/json_writer_unittest.py b/tools/grit/grit/format/policy_templates/writers/json_writer_unittest.py
index 16ad11bb1d11f36f0fb368c8b002ed06885bccc2..17e4272bf6826e4f31ac2622086ffc185ac9ded1 100644
--- a/tools/grit/grit/format/policy_templates/writers/json_writer_unittest.py
+++ b/tools/grit/grit/format/policy_templates/writers/json_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.
@@ -40,7 +40,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "policy_definitions": [],'
' "placeholders": [],'
'}', '<messages></messages>')
- output = self.GetOutput(grd, 'fr', {'_chromium': '1',}, 'json', 'en')
+ output = self.GetOutput(grd, 'fr', {'_chromium': '1', }, 'json', 'en')
expected_output = '{\n}'
self.CompareOutputs(output, expected_output)
@@ -98,6 +98,33 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
'}')
self.CompareOutputs(output, expected_output)
+ def testIntPolicy(self):
+ # Tests a policy group with a single policy of type 'string'.
+ grd = self.PrepareTest(
+ '{'
+ ' "policy_definitions": ['
+ ' {'
+ ' "name": "IntPolicy",'
+ ' "type": "int",'
+ ' "supported_on": ["chrome.linux:8-"],'
+ ' "annotations": {'
+ ' "example_value": 15'
+ ' }'
+ ' },'
+ ' ],'
+ ' "placeholders": [],'
+ '}',
+ '<messages>'
+ ' <message name="IDS_POLICY_INTPOLICY_CAPTION"></message>'
+ ' <message name="IDS_POLICY_INTPOLICY_DESC"></message>'
+ '</messages>')
+ output = self.GetOutput(grd, 'fr', {'_chromium' : '1'}, 'json', 'en')
+ expected_output = (
+ '{\n'
+ ' "IntPolicy": 15\n'
+ '}')
+ 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