Remove 'annotations' dictionary in policy_definitions.json.

The former members of the dict are now included directly in the policy definitions.

BUG=64898
TEST=existing unit tests in tools/grit/grit/format/policy_templates/

Review URL: http://codereview.chromium.org/6360002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71635 0039d316-1c4b-4281-b951-d872f2087c98
parent 54097492
This diff is collapsed.
...@@ -136,7 +136,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): ...@@ -136,7 +136,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter):
policy: The data structure of a policy. policy: The data structure of a policy.
''' '''
features = [] features = []
for key, value in policy['annotations']['features'].iteritems(): for key, value in policy['features'].iteritems():
key_name = self._FEATURE_MAP[key] key_name = self._FEATURE_MAP[key]
if value == 0: if value == 0:
value_name = self._GetLocalizedMessage('not_supported') value_name = self._GetLocalizedMessage('not_supported')
...@@ -153,7 +153,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): ...@@ -153,7 +153,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter):
policy: A policy of type 'list', for which the Mac example value policy: A policy of type 'list', for which the Mac example value
is generated. is generated.
''' '''
example_value = policy['annotations']['example_value'] example_value = policy['example_value']
self.AddElement(parent, 'dt', {}, 'Mac:') self.AddElement(parent, 'dt', {}, 'Mac:')
mac = self._AddStyledElement(parent, 'dd', ['.monospace', '.pre']) mac = self._AddStyledElement(parent, 'dd', ['.monospace', '.pre'])
...@@ -171,7 +171,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): ...@@ -171,7 +171,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter):
policy: A policy of type 'list', for which the Windows example value policy: A policy of type 'list', for which the Windows example value
is generated. is generated.
''' '''
example_value = policy['annotations']['example_value'] example_value = policy['example_value']
self.AddElement(parent, 'dt', {}, 'Windows:') self.AddElement(parent, 'dt', {}, 'Windows:')
win = self._AddStyledElement(parent, 'dd', ['.monospace', '.pre']) win = self._AddStyledElement(parent, 'dd', ['.monospace', '.pre'])
win_text = [] win_text = []
...@@ -191,7 +191,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): ...@@ -191,7 +191,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter):
policy: A policy of type 'list', for which the Linux example value policy: A policy of type 'list', for which the Linux example value
is generated. is generated.
''' '''
example_value = policy['annotations']['example_value'] example_value = policy['example_value']
self.AddElement(parent, 'dt', {}, 'Linux:') self.AddElement(parent, 'dt', {}, 'Linux:')
linux = self._AddStyledElement(parent, 'dd', ['.monospace']) linux = self._AddStyledElement(parent, 'dd', ['.monospace'])
linux_text = [] linux_text = []
...@@ -223,7 +223,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): ...@@ -223,7 +223,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter):
parent: The DOM node for which the example will be added. parent: The DOM node for which the example will be added.
policy: The data structure of a policy. policy: The data structure of a policy.
''' '''
example_value = policy['annotations']['example_value'] example_value = policy['example_value']
examples = self._AddStyledElement(parent, 'dl', ['dd dl']) examples = self._AddStyledElement(parent, 'dl', ['dd dl'])
self._AddListExampleWindows(examples, policy) self._AddListExampleWindows(examples, policy)
self._AddListExampleLinux(examples, policy) self._AddListExampleLinux(examples, policy)
...@@ -244,7 +244,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): ...@@ -244,7 +244,7 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter):
Exception: If the type of the policy is unknown or the example value Exception: If the type of the policy is unknown or the example value
of the policy is out of its expected range. of the policy is out of its expected range.
''' '''
example_value = policy['annotations']['example_value'] example_value = policy['example_value']
policy_type = policy['type'] policy_type = policy['type']
if policy_type == 'main': if policy_type == 'main':
if example_value == True: if example_value == True:
...@@ -330,7 +330,6 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): ...@@ -330,7 +330,6 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter):
parent: A DOM element for which the list will be added. parent: A DOM element for which the list will be added.
policy: The data structure of the policy. policy: The data structure of the policy.
''' '''
annotations = policy['annotations']
dl = self.AddElement(parent, 'dl') dl = self.AddElement(parent, 'dl')
self._AddPolicyAttribute( self._AddPolicyAttribute(
...@@ -363,9 +362,9 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter): ...@@ -363,9 +362,9 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter):
Args: Args:
policy: The data structure of the policy. policy: The data structure of the policy.
''' '''
if 'problem_href' not in policy['annotations']: if 'problem_href' not in policy:
return return
problem_href = policy['annotations']['problem_href'] problem_href = policy['problem_href']
div = self._AddStyledElement(parent, 'div', ['div.note']) div = self._AddStyledElement(parent, 'div', ['div.note'])
note = self._GetLocalizedMessage('note').replace('$6', problem_href) note = self._GetLocalizedMessage('note').replace('$6', problem_href)
self._AddTextWithLinks(div, note) self._AddTextWithLinks(div, note)
......
...@@ -196,9 +196,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex ...@@ -196,9 +196,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
def testAddFeatures(self): def testAddFeatures(self):
# Test if the list of features of a policy is handled correctly. # Test if the list of features of a policy is handled correctly.
policy = { policy = {
'annotations': { 'features': {'spaceship_docking': 0, 'dynamic_refresh': 1}
'features': {'spaceship_docking': 0, 'dynamic_refresh': 1}
}
} }
self.writer._FEATURE_MAP = { self.writer._FEATURE_MAP = {
'spaceship_docking': 'Spaceship Docking', 'spaceship_docking': 'Spaceship Docking',
...@@ -215,9 +213,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex ...@@ -215,9 +213,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
def testAddListExample(self): def testAddListExample(self):
policy = { policy = {
'name': 'PolicyName', 'name': 'PolicyName',
'annotations': { 'example_value': ['Foo', 'Bar']
'example_value': ['Foo', 'Bar']
}
} }
self.writer._AddListExample(self.doc_root, policy) self.writer._AddListExample(self.doc_root, policy)
self.assertEquals( self.assertEquals(
...@@ -248,9 +244,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex ...@@ -248,9 +244,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
policy = { policy = {
'name': 'PolicyName', 'name': 'PolicyName',
'type': 'main', 'type': 'main',
'annotations': { 'example_value': True
'example_value': True
}
} }
e1 = self.writer.AddElement(self.doc_root, 'e1') e1 = self.writer.AddElement(self.doc_root, 'e1')
self.writer._AddExample(e1, policy) self.writer._AddExample(e1, policy)
...@@ -261,9 +255,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex ...@@ -261,9 +255,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
policy = { policy = {
'name': 'PolicyName', 'name': 'PolicyName',
'type': 'main', 'type': 'main',
'annotations': { 'example_value': False
'example_value': False
}
} }
e2 = self.writer.AddElement(self.doc_root, 'e2') e2 = self.writer.AddElement(self.doc_root, 'e2')
self.writer._AddExample(e2, policy) self.writer._AddExample(e2, policy)
...@@ -276,9 +268,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex ...@@ -276,9 +268,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
policy = { policy = {
'name': 'PolicyName', 'name': 'PolicyName',
'type': 'int-enum', 'type': 'int-enum',
'annotations': { 'example_value': 16
'example_value': 16
}
} }
self.writer._AddExample(self.doc_root, policy) self.writer._AddExample(self.doc_root, policy)
self.assertEquals( self.assertEquals(
...@@ -290,9 +280,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex ...@@ -290,9 +280,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
policy = { policy = {
'name': 'PolicyName', 'name': 'PolicyName',
'type': 'string-enum', 'type': 'string-enum',
'annotations': { 'example_value': "wacky"
'example_value': "wacky"
}
} }
self.writer._AddExample(self.doc_root, policy) self.writer._AddExample(self.doc_root, policy)
self.assertEquals( self.assertEquals(
...@@ -304,9 +292,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex ...@@ -304,9 +292,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
policy = { policy = {
'name': 'PolicyName', 'name': 'PolicyName',
'type': 'string', 'type': 'string',
'annotations': { 'example_value': 'awesome-example'
'example_value': 'awesome-example'
}
} }
self.writer._AddExample(self.doc_root, policy) self.writer._AddExample(self.doc_root, policy)
self.assertEquals( self.assertEquals(
...@@ -318,9 +304,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex ...@@ -318,9 +304,7 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
policy = { policy = {
'name': 'PolicyName', 'name': 'PolicyName',
'type': 'int', 'type': 'int',
'annotations': { 'example_value': 26
'example_value': 26
}
} }
self.writer._AddExample(self.doc_root, policy) self.writer._AddExample(self.doc_root, policy)
self.assertEquals( self.assertEquals(
...@@ -351,10 +335,8 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex ...@@ -351,10 +335,8 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
'since_version': '8', 'since_version': '8',
'until_version': '', 'until_version': '',
}], }],
'annotations': { 'features': {'dynamic_refresh': 0},
'features': {'dynamic_refresh': 0}, 'example_value': False
'example_value': False
}
} }
self.writer.messages['doc_since_version'] = {'text': '...$6...'} self.writer.messages['doc_since_version'] = {'text': '...$6...'}
self.writer._AddPolicyDetails(self.doc_root, policy) self.writer._AddPolicyDetails(self.doc_root, policy)
...@@ -380,11 +362,11 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex ...@@ -380,11 +362,11 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
'</dl></root>') '</dl></root>')
def testAddPolicyNote(self): def testAddPolicyNote(self):
# TODO(jkummerow): The functionality tested by this test is currently not
# used for anything and will probably soon be removed.
# Test if nodes are correctly added to policies. # Test if nodes are correctly added to policies.
policy = { policy = {
'annotations': { 'problem_href': 'http://www.example.com/5'
'problem_href': 'http://www.example.com/5'
}
} }
self.writer.messages['doc_note'] = {'text': '...$6...'} self.writer.messages['doc_note'] = {'text': '...$6...'}
self.writer._AddPolicyNote(self.doc_root, policy) self.writer._AddPolicyNote(self.doc_root, policy)
...@@ -440,10 +422,8 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex ...@@ -440,10 +422,8 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
'since_version': '7', 'since_version': '7',
'until_version': '', 'until_version': '',
}], }],
'annotations': { 'features': {'dynamic_refresh': 0},
'features': {'dynamic_refresh': 0}, 'example_value': False
'example_value': False
}
} }
self.writer.messages['doc_since_version'] = {'text': '..$6..'} self.writer.messages['doc_since_version'] = {'text': '..$6..'}
self.writer._AddPolicySection(self.doc_root, policy) self.writer._AddPolicySection(self.doc_root, policy)
......
...@@ -26,7 +26,7 @@ class JsonWriter(template_writer.TemplateWriter): ...@@ -26,7 +26,7 @@ class JsonWriter(template_writer.TemplateWriter):
return self.FlattenGroupsAndSortPolicies(policy_list) return self.FlattenGroupsAndSortPolicies(policy_list)
def WritePolicy(self, policy): def WritePolicy(self, policy):
example_value = policy['annotations']['example_value'] example_value = policy['example_value']
if policy['type'] == 'string': if policy['type'] == 'string':
example_value_str = '"' + example_value + '"' example_value_str = '"' + example_value + '"'
elif policy['type'] == 'int': elif policy['type'] == 'int':
......
...@@ -56,9 +56,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -56,9 +56,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "caption": "",' ' "caption": "",'
' "desc": "",' ' "desc": "",'
' "supported_on": ["chrome.linux:8-"],' ' "supported_on": ["chrome.linux:8-"],'
' "annotations": {' ' "example_value": True'
' "example_value": True'
' }'
' },' ' },'
' ],' ' ],'
' "placeholders": [],' ' "placeholders": [],'
...@@ -82,9 +80,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -82,9 +80,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "caption": "",' ' "caption": "",'
' "desc": "",' ' "desc": "",'
' "supported_on": ["chrome.linux:8-"],' ' "supported_on": ["chrome.linux:8-"],'
' "annotations": {' ' "example_value": "hello, world!"'
' "example_value": "hello, world!"'
' }'
' },' ' },'
' ],' ' ],'
' "placeholders": [],' ' "placeholders": [],'
...@@ -108,9 +104,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -108,9 +104,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "caption": "",' ' "caption": "",'
' "desc": "",' ' "desc": "",'
' "supported_on": ["chrome.linux:8-"],' ' "supported_on": ["chrome.linux:8-"],'
' "annotations": {' ' "example_value": 15'
' "example_value": 15'
' }'
' },' ' },'
' ],' ' ],'
' "placeholders": [],' ' "placeholders": [],'
...@@ -138,9 +132,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -138,9 +132,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' {"name": "ProxyServerAutoDetect", "value": 1, "caption": ""},' ' {"name": "ProxyServerAutoDetect", "value": 1, "caption": ""},'
' ],' ' ],'
' "supported_on": ["chrome.linux:8-"],' ' "supported_on": ["chrome.linux:8-"],'
' "annotations": {' ' "example_value": 1'
' "example_value": 1'
' }'
' },' ' },'
' ],' ' ],'
' "placeholders": [],' ' "placeholders": [],'
...@@ -170,9 +162,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -170,9 +162,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "caption": ""},' ' "caption": ""},'
' ],' ' ],'
' "supported_on": ["chrome.linux:8-"],' ' "supported_on": ["chrome.linux:8-"],'
' "annotations": {' ' "example_value": "one"'
' "example_value": "one"'
' }'
' },' ' },'
' ],' ' ],'
' "placeholders": [],' ' "placeholders": [],'
...@@ -196,9 +186,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -196,9 +186,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "caption": "",' ' "caption": "",'
' "desc": "",' ' "desc": "",'
' "supported_on": ["chrome.linux:8-"],' ' "supported_on": ["chrome.linux:8-"],'
' "annotations": {' ' "example_value": ["foo", "bar"]'
' "example_value": ["foo", "bar"]'
' }'
' },' ' },'
' ],' ' ],'
' "placeholders": [],' ' "placeholders": [],'
...@@ -223,9 +211,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -223,9 +211,7 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "caption": "",' ' "caption": "",'
' "desc": "",' ' "desc": "",'
' "supported_on": ["chrome.mac:8-"],' ' "supported_on": ["chrome.mac:8-"],'
' "annotations": {' ' "example_value": ["a"]'
' "example_value": ["a"]'
' }'
' },' ' },'
' ],' ' ],'
' "placeholders": [],' ' "placeholders": [],'
...@@ -251,18 +237,14 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -251,18 +237,14 @@ class JsonWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "caption": "",' ' "caption": "",'
' "desc": "",' ' "desc": "",'
' "supported_on": ["chrome.linux:8-"],' ' "supported_on": ["chrome.linux:8-"],'
' "annotations": {' ' "example_value": ["a", "b"]'
' "example_value": ["a", "b"]'
' }'
' },{' ' },{'
' "name": "Policy2",' ' "name": "Policy2",'
' "type": "string",' ' "type": "string",'
' "caption": "",' ' "caption": "",'
' "desc": "",' ' "desc": "",'
' "supported_on": ["chrome.linux:8-"],' ' "supported_on": ["chrome.linux:8-"],'
' "annotations": {' ' "example_value": "c"'
' "example_value": "c"'
' }'
' }],' ' }],'
' },' ' },'
' ],' ' ],'
......
...@@ -50,7 +50,7 @@ class RegWriter(template_writer.TemplateWriter): ...@@ -50,7 +50,7 @@ class RegWriter(template_writer.TemplateWriter):
return (is_list, policy['name']) return (is_list, policy['name'])
def WritePolicy(self, policy): def WritePolicy(self, policy):
example_value = policy['annotations']['example_value'] example_value = policy['example_value']
if policy['type'] == 'list': if policy['type'] == 'list':
self._StartBlock(policy['name']) self._StartBlock(policy['name'])
......
...@@ -44,7 +44,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -44,7 +44,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "placeholders": [],' ' "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' expected_output = 'Windows Registry Editor Version 5.00'
self.CompareOutputs(output, expected_output) self.CompareOutputs(output, expected_output)
...@@ -59,9 +59,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -59,9 +59,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "caption": "",' ' "caption": "",'
' "desc": "",' ' "desc": "",'
' "supported_on": ["chrome.win:8-"],' ' "supported_on": ["chrome.win:8-"],'
' "annotations": {' ' "example_value": True'
' "example_value": True'
' }'
' },' ' },'
' ],' ' ],'
' "placeholders": [],' ' "placeholders": [],'
...@@ -86,9 +84,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -86,9 +84,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "caption": "",' ' "caption": "",'
' "desc": "",' ' "desc": "",'
' "supported_on": ["chrome.win:8-"],' ' "supported_on": ["chrome.win:8-"],'
' "annotations": {' ' "example_value": "hello, world! \\\" \\\\"'
' "example_value": "hello, world! \\\" \\\\"'
' }'
' },' ' },'
' ],' ' ],'
' "placeholders": [],' ' "placeholders": [],'
...@@ -113,9 +109,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -113,9 +109,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "caption": "",' ' "caption": "",'
' "desc": "",' ' "desc": "",'
' "supported_on": ["chrome.win:8-"],' ' "supported_on": ["chrome.win:8-"],'
' "annotations": {' ' "example_value": 26'
' "example_value": 26'
' }'
' },' ' },'
' ],' ' ],'
' "placeholders": [],' ' "placeholders": [],'
...@@ -144,9 +138,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -144,9 +138,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' {"name": "ProxyServerAutoDetect", "value": 1, "caption": ""},' ' {"name": "ProxyServerAutoDetect", "value": 1, "caption": ""},'
' ],' ' ],'
' "supported_on": ["chrome.win:8-"],' ' "supported_on": ["chrome.win:8-"],'
' "annotations": {' ' "example_value": 1'
' "example_value": 1'
' }'
' },' ' },'
' ],' ' ],'
' "placeholders": [],' ' "placeholders": [],'
...@@ -177,9 +169,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -177,9 +169,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "caption": ""},' ' "caption": ""},'
' ],' ' ],'
' "supported_on": ["chrome.win:8-"],' ' "supported_on": ["chrome.win:8-"],'
' "annotations": {' ' "example_value": "two"'
' "example_value": "two"'
' }'
' },' ' },'
' ],' ' ],'
' "placeholders": [],' ' "placeholders": [],'
...@@ -204,9 +194,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -204,9 +194,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "caption": "",' ' "caption": "",'
' "desc": "",' ' "desc": "",'
' "supported_on": ["chrome.linux:8-"],' ' "supported_on": ["chrome.linux:8-"],'
' "annotations": {' ' "example_value": ["foo", "bar"]'
' "example_value": ["foo", "bar"]'
' }'
' },' ' },'
' ],' ' ],'
' "placeholders": [],' ' "placeholders": [],'
...@@ -232,9 +220,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -232,9 +220,7 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "caption": "",' ' "caption": "",'
' "desc": "",' ' "desc": "",'
' "supported_on": ["chrome.mac:8-"],' ' "supported_on": ["chrome.mac:8-"],'
' "annotations": {' ' "example_value": ["a"]'
' "example_value": ["a"]'
' }'
' },' ' },'
' ],' ' ],'
' "placeholders": [],' ' "placeholders": [],'
...@@ -261,18 +247,14 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon): ...@@ -261,18 +247,14 @@ class RegWriterUnittest(writer_unittest_common.WriterUnittestCommon):
' "caption": "",' ' "caption": "",'
' "desc": "",' ' "desc": "",'
' "supported_on": ["chrome.win:8-"],' ' "supported_on": ["chrome.win:8-"],'
' "annotations": {' ' "example_value": ["a", "b"]'
' "example_value": ["a", "b"]'
' }'
' },{' ' },{'
' "name": "Policy2",' ' "name": "Policy2",'
' "type": "string",' ' "type": "string",'
' "caption": "",' ' "caption": "",'
' "desc": "",' ' "desc": "",'
' "supported_on": ["chrome.win:8-"],' ' "supported_on": ["chrome.win:8-"],'
' "annotations": {' ' "example_value": "c"'
' "example_value": "c"'
' }'
' }],' ' }],'
' },' ' },'
' ],' ' ],'
......
...@@ -178,7 +178,7 @@ class PolicyJson(skeleton_gatherer.SkeletonGatherer): ...@@ -178,7 +178,7 @@ class PolicyJson(skeleton_gatherer.SkeletonGatherer):
else: else:
str_val = item[key] str_val = item[key]
if type(str_val) == types.StringType: if type(str_val) == types.StringType:
str_val = "'%s'" % str_val str_val = "'%s'" % self.Escape(str_val)
else: else:
str_val = str(str_val) str_val = str(str_val)
self._AddNontranslateableChunk(str_val + ',\n') self._AddNontranslateableChunk(str_val + ',\n')
......
...@@ -39,10 +39,8 @@ class PolicyJsonUnittest(unittest.TestCase): ...@@ -39,10 +39,8 @@ class PolicyJsonUnittest(unittest.TestCase):
" 'name': 'HomepageLocation'," " 'name': 'HomepageLocation',"
" 'type': 'string'," " 'type': 'string',"
" 'supported_on': ['chrome.*:8-']," " 'supported_on': ['chrome.*:8-'],"
" 'annotations': {" " 'features': {'dynamic_refresh': 1},"
" 'features': {'dynamic_refresh': 1}," " 'example_value': 'http://chromium.org',"
" 'example_value': 'http://chromium.org',"
" },"
" 'caption': 'nothing special 1'," " 'caption': 'nothing special 1',"
" 'desc': 'nothing special 2'," " 'desc': 'nothing special 2',"
" 'label': 'nothing special 3'," " 'label': 'nothing special 3',"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment