Added new permissions video-capture, downloads, feature-detection, speaker-control

Also reorganised PERMISSIONS so it wasn't defined in two places.
This commit is contained in:
Andrew Williamson 2014-05-23 17:10:23 +01:00
Родитель fe685fd92d
Коммит 6ea7f8f94e
3 изменённых файлов: 24 добавлений и 23 удалений

Просмотреть файл

@ -31,15 +31,26 @@ MAX_GARBAGE = 100 * 1024
PERMISSIONS = {
'web': set([
'geolocation', 'alarms', 'fmradio', 'desktop-notification', 'storage',
'audio-channel-normal', 'audio-channel-content'
'alarms', 'audio-capture', 'audio-channel-content',
'audio-channel-normal', 'desktop-notification', 'fmradio',
'geolocation', 'push', 'storage', 'video-capture'
]),
'privileged': set([
'device-storage:pictures', 'device-storage:videos',
'device-storage:music', 'device-storage:sdcard', 'tcp-socket',
'browser', 'systemXHR', 'audio-channel-notification',
'audio-channel-alarm', 'contacts', 'mobilenetwork'
'audio-channel-alarm', 'audio-channel-notification', 'browser',
'contacts', 'device-storage:pictures', 'device-storage:videos',
'device-storage:music', 'device-storage:sdcard', 'feature-detection',
'input', 'mobilenetwork', 'speaker-control', 'systemXHR', 'tcp-socket'
]),
'certified': set([
'attention', 'audio-channel-ringer', 'audio-channel-telephony',
'audio-channel-publicnotification', 'background-sensors',
'backgroundservice', 'bluetooth', 'camera', 'cellbroadcast',
'downloads', 'device-storage:apps', 'embed-apps', 'idle',
'mobileconnection', 'network-events', 'networkstats-manage',
'open-remote-window', 'permissions', 'phonenumberservice', 'power',
'settings', 'sms', 'telephony', 'time', 'voicemail', 'webapps-manage',
'wifi-manage', 'wappush'
])
}
SHORT_LOCALES = {

Просмотреть файл

@ -4,7 +4,7 @@ import urlparse
import appvalidator.python.copy as copy
from ..constants import DESCRIPTION_TYPES
from ..constants import DESCRIPTION_TYPES, PERMISSIONS
from ..specprocessor import Spec, LITERAL_TYPE
@ -108,20 +108,6 @@ class WebappSpec(Spec):
"https://developer.mozilla.org/docs/Web/Apps/Manifest")
MIN_REQUIRED_ICON_SIZE = 128
PERMISSIONS = (
"alarms", "attention", "audio-capture", "audio-channel-normal",
"audio-channel-content", "audio-channel-notification",
"audio-channel-alarm", "audio-channel-ringer", "audio-channel-telephony",
"audio-channel-publicnotification", "background-sensors",
"backgroundservice", "bluetooth", "browser", "camera", "contacts",
"desktop-notification", "device-storage:apps", "device-storage:music",
"device-storage:pictures", "device-storage:sdcard",
"device-storage:videos", "embed-apps", "fmradio", "geolocation",
"idle", "input", "mobileconnection", "mobilenetwork",
"network-events", "networkstats-manage", "open-remote-window",
"permissions", "power", "push", "settings", "sms", "storage",
"systemXHR", "tcp-socket", "telephony", "time", "voicemail",
"webapps-manage", "wifi-manage")
PERMISSIONS_ACCESS = {
"contacts": _FULL_PERMISSIONS,
"device-storage:apps": _FULL_PERMISSIONS,
@ -232,7 +218,9 @@ class WebappSpec(Spec):
}
},
"permissions": {
"allowed_nodes": PERMISSIONS,
"allowed_nodes": PERMISSIONS['web'] |
PERMISSIONS['privileged'] |
PERMISSIONS['certified'],
"expected_type": dict,
"unknown_node_level": "error",
"child_nodes": {

Просмотреть файл

@ -800,7 +800,9 @@ class TestWebapps(WebappBaseTestCase):
def set_permissions(self):
"""Fill out the permissions node with every possible permission."""
self.data["permissions"] = {}
for perm in WebappSpec.PERMISSIONS:
for perm in set.union(appvalidator.constants.PERMISSIONS['web'],
appvalidator.constants.PERMISSIONS['privileged'],
appvalidator.constants.PERMISSIONS['certified']):
self.data["permissions"][perm] = {
"description": "Required to make things good."
}