Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / server2 / permissions_data_source_test.py
index 8c34da4..a4b37cf 100755 (executable)
@@ -3,13 +3,11 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-from collections import Mapping
 import json
 from operator import itemgetter
 import unittest
 
-from compiled_file_system import CompiledFileSystem
-from object_store_creator import ObjectStoreCreator
+from extensions_paths import CHROME_EXTENSIONS
 from permissions_data_source import PermissionsDataSource
 from server_instance import ServerInstance
 from third_party.handlebar import Handlebar
@@ -20,32 +18,28 @@ _PERMISSION_FEATURES = {
   # This will appear for extensions with a description as defined in the
   # permissions.json file.
   'activeTab': {
-    'name': 'activeTab',
-    'platforms': ['extensions'],
+    'extension_types': ['extension'],
   },
   # This will appear for apps and extensions with an auto-generated description
   # since the entry appears in _api_features.json.
   'alarms': {
-    'name': 'alarms',
-    'platforms': ['apps', 'extensions'],
+    'extension_types': ['platform_app', 'extension'],
   },
   # This won't appear for anything since there's no entry in permissions.json
   # and it's not an API.
   'audioCapture': {
-    'name': 'audioCapture',
-    'platforms': ['apps'],
+    'extension_types': ['platform_app'],
   },
   # This won't appear for anything because it's private.
   'commandLinePrivate': {
-    'name': 'commandLinePrivate',
-    'platforms': ['apps', 'extensions']
+    'extension_types': ['platform_app', 'extension']
   },
   # This will only appear for apps with an auto-generated description because
   # it's an API.
   'cookies': {
-    'name': 'cookies',
-    'platforms': ['apps']
+    'extension_types': ['platform_app']
   },
+  'host-permissions': {}
 }
 
 
@@ -53,11 +47,11 @@ _PERMISSIONS_JSON = {
   # This will appear for both apps and extensions with a custom description,
   # anchor, etc.
   'host-permissions': {
-    'name': 'match pattern',
     'anchor': 'custom-anchor',
+    'extension_types': ['platform_app', 'extension'],
+    'literal_name': True,
+    'name': 'match pattern',
     'partial': 'permissions/host_permissions.html',
-    'platforms': ['apps', 'extensions'],
-    'literal_name': True
   },
   # A custom 'partial' here overrides the default partial.
   'activeTab': {
@@ -89,21 +83,24 @@ class PermissionsDataSourceTest(unittest.TestCase):
       {
         'anchor': 'custom-anchor',
         'description': 'host permissions',
+        'extension_types': ['platform_app', 'extension'],
         'literal_name': True,
         'name': 'match pattern',
-        'platforms': ['apps', 'extensions']
+        'channel': 'stable'
       },
       {
         'anchor': 'activeTab',
         'description': 'active tab',
+        'extension_types': ['extension'],
         'name': 'activeTab',
-        'platforms': ['extensions'],
+        'channel': 'stable'
       },
       {
         'anchor': 'alarms',
         'description': 'generic description',
+        'extension_types': ['platform_app', 'extension'],
         'name': 'alarms',
-        'platforms': ['apps', 'extensions'],
+        'channel': 'stable'
       },
     ]
 
@@ -111,21 +108,24 @@ class PermissionsDataSourceTest(unittest.TestCase):
       {
         'anchor': 'custom-anchor',
         'description': 'host permissions',
+        'extension_types': ['platform_app', 'extension'],
         'literal_name': True,
         'name': 'match pattern',
-        'platforms': ['apps', 'extensions'],
+        'channel': 'stable'
       },
       {
         'anchor': 'alarms',
         'description': 'generic description',
+        'extension_types': ['platform_app', 'extension'],
         'name': 'alarms',
-        'platforms': ['apps', 'extensions'],
+        'channel': 'stable'
       },
       {
         'anchor': 'cookies',
         'description': 'generic description',
+        'extension_types': ['platform_app'],
         'name': 'cookies',
-        'platforms': ['apps'],
+        'channel': 'stable'
       },
     ]
 
@@ -146,7 +146,7 @@ class PermissionsDataSourceTest(unittest.TestCase):
           },
         }
       }
-    })
+    }, relative_to=CHROME_EXTENSIONS)
 
     permissions_data_source = PermissionsDataSource(
         ServerInstance.ForTest(test_file_system), None)
@@ -170,5 +170,6 @@ class PermissionsDataSourceTest(unittest.TestCase):
     self.assertEqual(expected_extensions, actual_extensions)
     self.assertEqual(expected_apps, actual_apps)
 
+
 if __name__ == '__main__':
   unittest.main()