| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import json | 6 import json |
| 7 import unittest | 7 import unittest |
| 8 | 8 |
| 9 from extensions_paths import CHROME_EXTENSIONS | 9 from extensions_paths import CHROME_EXTENSIONS |
| 10 from server_instance import ServerInstance | 10 from server_instance import ServerInstance |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 { | 22 { |
| 23 'channel': 'stable', | 23 'channel': 'stable', |
| 24 'extension_types': ['extension'] | 24 'extension_types': ['extension'] |
| 25 }, | 25 }, |
| 26 { | 26 { |
| 27 'channel': 'stable', | 27 'channel': 'stable', |
| 28 'extension_types': ['platform_app'], | 28 'extension_types': ['platform_app'], |
| 29 'whitelist': ['im not here'] | 29 'whitelist': ['im not here'] |
| 30 } | 30 } |
| 31 ], | 31 ], |
| 32 'inheritsFromDifferentDependencyName': { |
| 33 'dependencies': ['manifest:inheritsPlatformAndChannelFromDependency'] |
| 34 }, |
| 35 'inheritsPlatformAndChannelFromDependency': { |
| 36 'dependencies': ['manifest:inheritsPlatformAndChannelFromDependency'] |
| 37 }, |
| 32 'omnibox': { | 38 'omnibox': { |
| 33 'dependencies': ['manifest:omnibox'], | 39 'dependencies': ['manifest:omnibox'], |
| 34 'contexts': ['blessed_extension'] | 40 'contexts': ['blessed_extension'] |
| 35 }, | 41 }, |
| 36 'syncFileSystem': { | 42 'syncFileSystem': { |
| 37 'dependencies': ['permission:syncFileSystem'], | 43 'dependencies': ['permission:syncFileSystem'], |
| 38 'contexts': ['blessed_extension'] | 44 'contexts': ['blessed_extension'] |
| 39 }, | 45 }, |
| 40 'tabs': { | 46 'tabs': { |
| 41 'channel': 'stable', | 47 'channel': 'stable', |
| 42 'extension_types': ['extension', 'legacy_packaged_app'], | 48 'extension_types': ['extension', 'legacy_packaged_app'], |
| 43 'contexts': ['blessed_extension'] | 49 'contexts': ['blessed_extension'] |
| 44 }, | 50 }, |
| 45 'test': { | 51 'test': { |
| 46 'channel': 'stable', | 52 'channel': 'stable', |
| 47 'extension_types': 'all', | 53 'extension_types': 'all', |
| 48 'contexts': [ | 54 'contexts': [ |
| 49 'blessed_extension', 'unblessed_extension', 'content_script'] | 55 'blessed_extension', 'unblessed_extension', 'content_script'] |
| 50 }, | 56 }, |
| 57 'overridesPlatformAndChannelFromDependency': { |
| 58 'channel': 'beta', |
| 59 'dependencies': [ |
| 60 'permission:overridesPlatformAndChannelFromDependency' |
| 61 ], |
| 62 'extension_types': ['platform_app'] |
| 63 }, |
| 51 'windows': { | 64 'windows': { |
| 52 'dependencies': ['api:tabs'], | 65 'dependencies': ['api:tabs'], |
| 53 'contexts': ['blessed_extension'] | 66 'contexts': ['blessed_extension'] |
| 54 } | 67 } |
| 55 }), | 68 }), |
| 56 '_manifest_features.json': json.dumps({ | 69 '_manifest_features.json': json.dumps({ |
| 57 'app.content_security_policy': { | 70 'app.content_security_policy': { |
| 58 'channel': 'stable', | 71 'channel': 'stable', |
| 59 'extension_types': ['platform_app'], | 72 'extension_types': ['platform_app'], |
| 60 'min_manifest_version': 2, | 73 'min_manifest_version': 2, |
| 61 'whitelist': ['this isnt happening'] | 74 'whitelist': ['this isnt happening'] |
| 62 }, | 75 }, |
| 63 'background': { | 76 'background': { |
| 64 'channel': 'stable', | 77 'channel': 'stable', |
| 65 'extension_types': ['extension', 'legacy_packaged_app', 'hosted_app'] | 78 'extension_types': ['extension', 'legacy_packaged_app', 'hosted_app'] |
| 66 }, | 79 }, |
| 80 'inheritsPlatformAndChannelFromDependency': { |
| 81 'channel': 'dev', |
| 82 'extension_types': ['extension'] |
| 83 }, |
| 67 'manifest_version': { | 84 'manifest_version': { |
| 68 'channel': 'stable', | 85 'channel': 'stable', |
| 69 'extension_types': 'all' | 86 'extension_types': 'all' |
| 70 }, | 87 }, |
| 71 'omnibox': { | 88 'omnibox': { |
| 72 'channel': 'stable', | 89 'channel': 'stable', |
| 73 'extension_types': ['extension'], | 90 'extension_types': ['extension'], |
| 74 'platforms': ['win'] | 91 'platforms': ['win'] |
| 75 }, | 92 }, |
| 76 'page_action': { | 93 'page_action': { |
| 77 'channel': 'stable', | 94 'channel': 'stable', |
| 78 'extension_types': ['extension'] | 95 'extension_types': ['extension'] |
| 79 }, | 96 }, |
| 80 'sockets': { | 97 'sockets': { |
| 81 'channel': 'dev', | 98 'channel': 'dev', |
| 82 'extension_types': ['platform_app'] | 99 'extension_types': ['platform_app'] |
| 83 } | 100 } |
| 84 }), | 101 }), |
| 85 '_permission_features.json': json.dumps({ | 102 '_permission_features.json': json.dumps({ |
| 86 'bluetooth': { | 103 'bluetooth': { |
| 87 'channel': 'dev', | 104 'channel': 'dev', |
| 88 'extension_types': ['platform_app'] | 105 'extension_types': ['platform_app'] |
| 89 }, | 106 }, |
| 107 'overridesPlatformAndChannelFromDependency': { |
| 108 'channel': 'stable', |
| 109 'extension_types': ['extension'] |
| 110 }, |
| 90 'power': { | 111 'power': { |
| 91 'channel': 'stable', | 112 'channel': 'stable', |
| 92 'extension_types': [ | 113 'extension_types': [ |
| 93 'extension', 'legacy_packaged_app', 'platform_app' | 114 'extension', 'legacy_packaged_app', 'platform_app' |
| 94 ] | 115 ] |
| 95 }, | 116 }, |
| 96 'syncFileSystem': { | 117 'syncFileSystem': { |
| 97 'channel': 'stable', | 118 'channel': 'beta', |
| 98 'extension_types': ['platform_app'] | 119 'extension_types': ['platform_app'] |
| 99 }, | 120 }, |
| 100 'tabs': { | 121 'tabs': { |
| 101 'channel': 'stable', | 122 'channel': 'stable', |
| 102 'extension_types': ['extension'] | 123 'extension_types': ['extension'] |
| 103 } | 124 } |
| 104 }) | 125 }) |
| 105 }, | 126 }, |
| 106 'docs': { | 127 'docs': { |
| 107 'templates': { | 128 'templates': { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 TestFileSystem(_TEST_FILESYSTEM, relative_to=CHROME_EXTENSIONS)) | 163 TestFileSystem(_TEST_FILESYSTEM, relative_to=CHROME_EXTENSIONS)) |
| 143 | 164 |
| 144 def testManifestFeatures(self): | 165 def testManifestFeatures(self): |
| 145 expected_features = { | 166 expected_features = { |
| 146 'background': { | 167 'background': { |
| 147 'name': 'background', | 168 'name': 'background', |
| 148 'channel': 'stable', | 169 'channel': 'stable', |
| 149 'platforms': ['extensions'], | 170 'platforms': ['extensions'], |
| 150 'documentation': 'background_pages.html' | 171 'documentation': 'background_pages.html' |
| 151 }, | 172 }, |
| 173 'inheritsPlatformAndChannelFromDependency': { |
| 174 'channel': 'dev', |
| 175 'name': 'inheritsPlatformAndChannelFromDependency', |
| 176 'platforms': ['extensions'] |
| 177 }, |
| 152 'manifest_version': { | 178 'manifest_version': { |
| 153 'name': 'manifest_version', | 179 'name': 'manifest_version', |
| 154 'channel': 'stable', | 180 'channel': 'stable', |
| 155 'platforms': ['apps', 'extensions'], | 181 'platforms': ['apps', 'extensions'], |
| 156 'documentation': 'manifest/manifest_version.html', | 182 'documentation': 'manifest/manifest_version.html', |
| 157 'level': 'required', | 183 'level': 'required', |
| 158 'example': 2 | 184 'example': 2 |
| 159 }, | 185 }, |
| 160 'omnibox': { | 186 'omnibox': { |
| 161 'name': 'omnibox', | 187 'name': 'omnibox', |
| (...skipping 22 matching lines...) Expand all Loading... |
| 184 expected_features = { | 210 expected_features = { |
| 185 'bluetooth': { | 211 'bluetooth': { |
| 186 'name': 'bluetooth', | 212 'name': 'bluetooth', |
| 187 'channel': 'dev', | 213 'channel': 'dev', |
| 188 'platforms': ['apps'], | 214 'platforms': ['apps'], |
| 189 }, | 215 }, |
| 190 'fakeUnsupportedFeature': { | 216 'fakeUnsupportedFeature': { |
| 191 'name': 'fakeUnsupportedFeature', | 217 'name': 'fakeUnsupportedFeature', |
| 192 'platforms': [] | 218 'platforms': [] |
| 193 }, | 219 }, |
| 220 'overridesPlatformAndChannelFromDependency': { |
| 221 'name': 'overridesPlatformAndChannelFromDependency', |
| 222 'channel': 'stable', |
| 223 'platforms': ['extensions'] |
| 224 }, |
| 194 'power': { | 225 'power': { |
| 195 'name': 'power', | 226 'name': 'power', |
| 196 'channel': 'stable', | 227 'channel': 'stable', |
| 197 'platforms': ['apps', 'extensions'], | 228 'platforms': ['apps', 'extensions'], |
| 198 }, | 229 }, |
| 199 'syncFileSystem': { | 230 'syncFileSystem': { |
| 200 'name': 'syncFileSystem', | 231 'name': 'syncFileSystem', |
| 201 'channel': 'stable', | 232 'channel': 'beta', |
| 202 'platforms': ['apps'], | 233 'platforms': ['apps'], |
| 203 'partial': 'permissions/sync_file_system.html' | 234 'partial': 'permissions/sync_file_system.html' |
| 204 }, | 235 }, |
| 205 'tabs': { | 236 'tabs': { |
| 206 'name': 'tabs', | 237 'name': 'tabs', |
| 207 'channel': 'stable', | 238 'channel': 'stable', |
| 208 'platforms': ['extensions'], | 239 'platforms': ['extensions'], |
| 209 'partial': 'permissions/tabs.html' | 240 'partial': 'permissions/tabs.html' |
| 210 } | 241 } |
| 211 } | 242 } |
| 212 self.assertEqual( | 243 self.assertEqual( |
| 213 expected_features, | 244 expected_features, |
| 214 self._server.features_bundle.GetPermissionFeatures().Get()) | 245 self._server.features_bundle.GetPermissionFeatures().Get()) |
| 215 | 246 |
| 216 def testAPIFeatures(self): | 247 def testAPIFeatures(self): |
| 217 expected_features = { | 248 expected_features = { |
| 218 'audioCapture': { | 249 'audioCapture': { |
| 219 'name': 'audioCapture', | 250 'name': 'audioCapture', |
| 220 'channel': 'stable', | 251 'channel': 'stable', |
| 221 'platforms': ['apps'] | 252 'platforms': ['apps'] |
| 222 }, | 253 }, |
| 223 'background': { | 254 'background': { |
| 224 'name': 'background', | 255 'name': 'background', |
| 225 'channel': 'stable', | 256 'channel': 'stable', |
| 226 'platforms': ['extensions'] | 257 'platforms': ['extensions'] |
| 227 }, | 258 }, |
| 259 'inheritsFromDifferentDependencyName': { |
| 260 'channel': 'dev', |
| 261 'name': 'inheritsFromDifferentDependencyName', |
| 262 'dependencies': ['manifest:inheritsPlatformAndChannelFromDependency'], |
| 263 'platforms': ['extensions'] |
| 264 }, |
| 265 'inheritsPlatformAndChannelFromDependency': { |
| 266 'channel': 'dev', |
| 267 'name': 'inheritsPlatformAndChannelFromDependency', |
| 268 'dependencies': ['manifest:inheritsPlatformAndChannelFromDependency'], |
| 269 'platforms': ['extensions'] |
| 270 }, |
| 228 'omnibox': { | 271 'omnibox': { |
| 272 'channel': 'stable', |
| 229 'name': 'omnibox', | 273 'name': 'omnibox', |
| 230 'platforms': ['extensions'], | 274 'platforms': ['extensions'], |
| 231 'contexts': ['blessed_extension'], | 275 'contexts': ['blessed_extension'], |
| 232 'dependencies': ['manifest:omnibox'] | 276 'dependencies': ['manifest:omnibox'] |
| 233 }, | 277 }, |
| 278 'overridesPlatformAndChannelFromDependency': { |
| 279 'channel': 'beta', |
| 280 'name': 'overridesPlatformAndChannelFromDependency', |
| 281 'dependencies': [ |
| 282 'permission:overridesPlatformAndChannelFromDependency' |
| 283 ], |
| 284 'platforms': ['apps'] |
| 285 }, |
| 234 'syncFileSystem': { | 286 'syncFileSystem': { |
| 287 'channel': 'beta', |
| 235 'name': 'syncFileSystem', | 288 'name': 'syncFileSystem', |
| 236 'platforms': ['apps'], | 289 'platforms': ['apps'], |
| 237 'contexts': ['blessed_extension'], | 290 'contexts': ['blessed_extension'], |
| 238 'dependencies': ['permission:syncFileSystem'] | 291 'dependencies': ['permission:syncFileSystem'] |
| 239 }, | 292 }, |
| 240 'tabs': { | 293 'tabs': { |
| 294 'channel': 'stable', |
| 241 'name': 'tabs', | 295 'name': 'tabs', |
| 242 'channel': 'stable', | 296 'channel': 'stable', |
| 243 'platforms': ['extensions'], | 297 'platforms': ['extensions'], |
| 244 'contexts': ['blessed_extension'], | 298 'contexts': ['blessed_extension'], |
| 245 }, | 299 }, |
| 246 'test': { | 300 'test': { |
| 301 'channel': 'stable', |
| 247 'name': 'test', | 302 'name': 'test', |
| 248 'channel': 'stable', | 303 'channel': 'stable', |
| 249 'platforms': ['apps', 'extensions'], | 304 'platforms': ['apps', 'extensions'], |
| 250 'contexts': [ | 305 'contexts': [ |
| 251 'blessed_extension', 'unblessed_extension', 'content_script'], | 306 'blessed_extension', 'unblessed_extension', 'content_script'], |
| 252 }, | 307 }, |
| 253 'windows': { | 308 'windows': { |
| 309 'channel': 'stable', |
| 254 'name': 'windows', | 310 'name': 'windows', |
| 255 'platforms': ['extensions'], | 311 'platforms': ['extensions'], |
| 256 'contexts': ['blessed_extension'], | 312 'contexts': ['blessed_extension'], |
| 257 'dependencies': ['api:tabs'] | 313 'dependencies': ['api:tabs'] |
| 258 } | 314 } |
| 259 } | 315 } |
| 260 self.assertEqual( | 316 self.assertEqual( |
| 261 expected_features, | 317 expected_features, |
| 262 self._server.features_bundle.GetAPIFeatures().Get()) | 318 self._server.features_bundle.GetAPIFeatures().Get()) |
| 263 | 319 |
| 264 | 320 |
| 265 if __name__ == '__main__': | 321 if __name__ == '__main__': |
| 266 unittest.main() | 322 unittest.main() |
| OLD | NEW |