Commit 60ef9794 authored by Owen Min's avatar Owen Min Committed by Commit Bot

Cleanup few policy template presubmit warnings.

Also fix an issue in the presubmit script when supported_on is empty.

Change-Id: Ic72f06e05e11052fecba8dd013f28ba77a37848c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2368174
Commit-Queue: Owen Min <zmin@chromium.org>
Reviewed-by: default avatarYann Dago <ydago@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800684}
parent 0a9d3e3e
...@@ -5713,7 +5713,6 @@ ...@@ -5713,7 +5713,6 @@
'caption': '''Do not allow any site to access sensors''', 'caption': '''Do not allow any site to access sensors''',
} }
], ],
'supported_on': [],
'future_on': ['chrome.*', 'chrome_os', 'android'], 'future_on': ['chrome.*', 'chrome_os', 'android'],
'features': { 'features': {
'dynamic_refresh': True, 'dynamic_refresh': True,
...@@ -6583,7 +6582,6 @@ ...@@ -6583,7 +6582,6 @@
], ],
'type': 'main', 'type': 'main',
'schema': { 'type': 'boolean' }, 'schema': { 'type': 'boolean' },
'supported_on': [],
'future_on': [ 'future_on': [
'chrome.*', 'chrome.*',
'chrome_os', 'chrome_os',
...@@ -6625,7 +6623,6 @@ ...@@ -6625,7 +6623,6 @@
'type': 'array', 'type': 'array',
'items': { 'type': 'string' }, 'items': { 'type': 'string' },
}, },
'supported_on': [],
'future_on': [ 'future_on': [
'chrome.*', 'chrome.*',
'chrome_os', 'chrome_os',
...@@ -6847,7 +6844,6 @@ ...@@ -6847,7 +6844,6 @@
'type': 'array', 'type': 'array',
'items': { 'type': 'string' }, 'items': { 'type': 'string' },
}, },
'supported_on': [],
'future_on': ['chrome.*', 'chrome_os', 'android'], 'future_on': ['chrome.*', 'chrome_os', 'android'],
'features': { 'features': {
'dynamic_refresh': True, 'dynamic_refresh': True,
...@@ -6873,7 +6869,6 @@ ...@@ -6873,7 +6869,6 @@
'type': 'array', 'type': 'array',
'items': { 'type': 'string' }, 'items': { 'type': 'string' },
}, },
'supported_on': [],
'future_on': ['chrome.*', 'chrome_os', 'android'], 'future_on': ['chrome.*', 'chrome_os', 'android'],
'features': { 'features': {
'dynamic_refresh': True, 'dynamic_refresh': True,
...@@ -16236,7 +16231,6 @@ ...@@ -16236,7 +16231,6 @@
'type': 'main', 'type': 'main',
'schema': { 'type': 'boolean' }, 'schema': { 'type': 'boolean' },
'future_on': ['chrome_os'], 'future_on': ['chrome_os'],
'supported_on': [],
'features': { 'features': {
'dynamic_refresh': True, 'dynamic_refresh': True,
'per_profile': True, 'per_profile': True,
...@@ -18637,8 +18631,8 @@ ...@@ -18637,8 +18631,8 @@
'items': { 'type': 'string' }, 'items': { 'type': 'string' },
}, },
'supported_on': ['chrome.*:70-','android:70-','chrome_os:70-'], 'supported_on': ['chrome.*:70-','android:70-','chrome_os:70-'],
'internal_only': True,
'features': { 'features': {
'internal_only': True,
'dynamic_refresh': True, 'dynamic_refresh': True,
'per_profile': True, 'per_profile': True,
}, },
...@@ -23218,7 +23212,6 @@ If you disable this policy, web page scrolling to specific text fragments via UR ...@@ -23218,7 +23212,6 @@ If you disable this policy, web page scrolling to specific text fragments via UR
'owners': ['skym@chromium.org', 'wenyufu@chromium.org', 'twellington@chromium.org'], 'owners': ['skym@chromium.org', 'wenyufu@chromium.org', 'twellington@chromium.org'],
'type': 'main', 'type': 'main',
'schema': { 'type': 'boolean' }, 'schema': { 'type': 'boolean' },
'supported_on': [],
'future_on': ['android'], 'future_on': ['android'],
'features': { 'features': {
'dynamic_refresh': False, 'dynamic_refresh': False,
...@@ -88,6 +88,7 @@ class PolicyDetails: ...@@ -88,6 +88,7 @@ class PolicyDetails:
features = policy.get('features', {}) features = policy.get('features', {})
self.can_be_recommended = features.get('can_be_recommended', False) self.can_be_recommended = features.get('can_be_recommended', False)
self.can_be_mandatory = features.get('can_be_mandatory', True) self.can_be_mandatory = features.get('can_be_mandatory', True)
self.internal_only = features.get('internal_only', False)
self.is_deprecated = policy.get('deprecated', False) self.is_deprecated = policy.get('deprecated', False)
self.is_device_only = policy.get('device_only', False) self.is_device_only = policy.get('device_only', False)
self.is_future = policy.get('future', False) self.is_future = policy.get('future', False)
...@@ -1658,8 +1659,9 @@ def _WriteAppRestrictions(policies, policy_atomic_groups, target_platform, f, ...@@ -1658,8 +1659,9 @@ def _WriteAppRestrictions(policies, policy_atomic_groups, target_platform, f,
f.write('<restrictions xmlns:android="' f.write('<restrictions xmlns:android="'
'http://schemas.android.com/apk/res/android">\n\n') 'http://schemas.android.com/apk/res/android">\n\n')
for policy in policies: for policy in policies:
if (policy.is_supported and policy.restriction_type != 'invalid' and if (policy.is_supported and policy.restriction_type != 'invalid'
not policy.is_deprecated and not policy.is_future): and not policy.is_deprecated and not policy.is_future
and not policy.internal_only):
WriteAppRestriction(policy) WriteAppRestriction(policy)
f.write('</restrictions>') f.write('</restrictions>')
......
...@@ -665,9 +665,9 @@ class PolicyTemplateChecker(object): ...@@ -665,9 +665,9 @@ class PolicyTemplateChecker(object):
'policy', policy.get('name', policy)) 'policy', policy.get('name', policy))
# All user policies must have a per_profile feature flag. # All user policies must have a per_profile feature flag.
if (not policy.get('device_only', False) and if (not policy.get('device_only', False)
not policy.get('deprecated', False) and and not policy.get('deprecated', False)
not filter(re.compile('^chrome_frame:.*').match, supported_on)): and not 'chrome_frame' in supported_platforms):
self._CheckContains( self._CheckContains(
features, features,
'per_profile', 'per_profile',
......
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