Commit 36ad7565 authored by bartfab's avatar bartfab Committed by Commit bot

Document ARC support for Chrome policies

We distinguish three cases:
 * Policies that control browser behavior. These implicitly apply to
   Chrome on Chrome OS only. No documentation updates are needed.
 * Policies that affect parts of the system which lie outside the scope
   of ARC, e.g. the login screen and auto-update system. These
   implicitly apply to Chrome OS only. No documentation updates are
   needed.
 * Policies that directly or indirectly influence app behavior. The
   default assumption is that any such policy applies to both Chrome
   and Android apps. This CL adds a note to the generated documentation
   whenever this is not the case.

BUG=b/28039197 b/28109303
TEST=ninja -C out/out policy_templates

Review-Url: https://codereview.chromium.org/2278493004
Cr-Commit-Position: refs/heads/master@{#415140}
parent 652e2642
......@@ -185,7 +185,7 @@ class PolicyTemplateChecker(object):
'supported_on', 'label', 'policies', 'items',
'example_value', 'features', 'deprecated', 'future',
'id', 'schema', 'max_size', 'tags',
'default_for_enterprise_users'):
'default_for_enterprise_users', 'arc_support'):
self.warning_count += 1
print ('In policy %s: Warning: Unknown key: %s' %
(policy.get('name'), key))
......@@ -217,6 +217,9 @@ class PolicyTemplateChecker(object):
# If 'future' is present, it must be a bool.
self._CheckContains(policy, 'future', bool, True)
# If 'arc_support' is present, it must be a string.
self._CheckContains(policy, 'arc_support', str, True)
if policy_type == 'group':
# Groups must not be nested.
if is_in_group:
......
......@@ -116,6 +116,9 @@ class PolicyTemplateGenerator:
policy['caption'] = self._ImportMessage(policy['caption'])
if 'label' in policy:
policy['label'] = self._ImportMessage(policy['label'])
if 'arc_support' in policy:
policy['arc_support'] = self._ImportMessage(policy['arc_support'])
if policy['type'] == 'group':
self._ProcessPolicyList(policy['policies'])
......
......@@ -538,6 +538,9 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter):
self._AddFeatures(dd, policy)
dd = self._AddPolicyAttribute(dl, 'description')
self._AddDescription(dd, policy)
if 'arc_support' in policy:
dd = self._AddPolicyAttribute(dl, 'arc_support')
self._AddParagraphs(dd, policy['arc_support'])
if (self.IsPolicySupportedOnPlatform(policy, 'win') or
self.IsPolicySupportedOnPlatform(policy, 'linux') or
self.IsPolicySupportedOnPlatform(policy, 'android') or
......
......@@ -48,6 +48,7 @@ class DocWriterUnittest(writer_unittest_common.WriterUnittestCommon):
'doc_complex_policies_on_windows': {'text': '_test_complex_policies_win'},
'doc_data_type': {'text': '_test_data_type'},
'doc_description': {'text': '_test_description'},
'doc_arc_support': {'text': '_test_arc_support'},
'doc_description_column_title': {
'text': '_test_description_column_title'
},
......@@ -434,7 +435,8 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
'until_version': '',
}],
'features': {'dynamic_refresh': False},
'example_value': False
'example_value': False,
'arc_support': 'TestArcSupportNote'
}
self.writer.messages['doc_since_version'] = {'text': '...$6...'}
self.writer._AddPolicyDetails(self.doc_root, policy)
......@@ -463,11 +465,53 @@ See <a href="http://policy-explanation.example.com">http://policy-explanation.ex
'<dt style="style_dt;">_test_supported_features</dt>'
'<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>'
'<dt style="style_dt;">_test_description</dt><dd><p>TestPolicyDesc</p></dd>'
'<dt style="style_dt;">_test_arc_support</dt>'
'<dd><p>TestArcSupportNote</p></dd>'
'<dt style="style_dt;">_test_example_value</dt>'
'<dd>0x00000000 (Windows), false (Linux),'
' false (Android), &lt;false /&gt; (Mac)</dd>'
'</dl></root>')
def testAddPolicyDetailsNoArcSupport(self):
# Test that the entire Android-on-Chrome-OS sub-section is left out when
# 'arc_support' is not specified.
policy = {
'type': 'main',
'name': 'TestPolicyName',
'caption': 'TestPolicyCaption',
'desc': 'TestPolicyDesc',
'supported_on': [{
'product': 'chrome',
'platforms': ['linux'],
'since_version': '8',
'until_version': '',
}],
'features': {'dynamic_refresh': False},
'example_value': False
}
self.writer.messages['doc_since_version'] = {'text': '...$6...'}
self.writer._AddPolicyDetails(self.doc_root, policy)
self.assertEquals(
self.doc_root.toxml(),
'<root><dl>'
'<dt style="style_dt;">_test_data_type</dt>'
'<dd>Boolean</dd>'
'<dt style="style_dt;">_test_mac_linux_pref_name</dt>'
'<dd style="style_.monospace;">TestPolicyName</dd>'
'<dt style="style_dt;">_test_supported_on</dt>'
'<dd>'
'<ul style="style_ul;">'
'<li>Chrome (Linux) ...8...</li>'
'</ul>'
'</dd>'
'<dt style="style_dt;">_test_supported_features</dt>'
'<dd>_test_feature_dynamic_refresh: _test_not_supported</dd>'
'<dt style="style_dt;">_test_description</dt>'
'<dd><p>TestPolicyDesc</p></dd>'
'<dt style="style_dt;">_test_example_value</dt>'
'<dd>false (Linux)</dd>'
'</dl></root>')
def testAddDictPolicyDetails(self):
# Test if the definition list (<dl>) of policy details is created correctly
# for 'dict' policies.
......
......@@ -18,7 +18,7 @@ from xml.parsers.expat import ExpatError
class PolicyJson(skeleton_gatherer.SkeletonGatherer):
'''Collects and translates the following strings from policy_templates.json:
- captions,descriptions and labels of policies
- captions, descriptions, labels and Android app support details of policies
- captions of enumeration items
- misc strings from the 'messages' section
Translatable strings may have untranslateable placeholders with the same
......@@ -145,6 +145,7 @@ class PolicyJson(skeleton_gatherer.SkeletonGatherer):
'desc': 'Description',
'caption': 'Caption',
'label': 'Label',
'arc_support': 'Information about the effect on Android apps'
}
if item_type == 'policy':
return '%s of the policy named %s' % (key_map[key], item['name'])
......@@ -170,7 +171,7 @@ class PolicyJson(skeleton_gatherer.SkeletonGatherer):
depth: The level of indentation.
'''
self._AddIndentedNontranslateableChunk(depth, "'%s': " % key)
if key in ('desc', 'caption', 'label'):
if key in ('desc', 'caption', 'label', 'arc_support'):
self._AddNontranslateableChunk("'''")
self._ParseMessage(
item[key],
......
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