OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
6 | 6 |
7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 290 } |
291 | 291 |
292 TEST_F(ExtensionManifestTest, PlatformApps) { | 292 TEST_F(ExtensionManifestTest, PlatformApps) { |
293 // A minimal platform app. | 293 // A minimal platform app. |
294 LoadAndExpectError("init_valid_platform_app.json", | 294 LoadAndExpectError("init_valid_platform_app.json", |
295 errors::kPlatformAppFlagRequired); | 295 errors::kPlatformAppFlagRequired); |
296 | 296 |
297 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); | 297 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); |
298 | 298 |
299 LoadAndExpectSuccess("init_valid_platform_app.json"); | 299 LoadAndExpectSuccess("init_valid_platform_app.json"); |
| 300 |
| 301 LoadAndExpectError( |
| 302 "init_invalid_platform_app_1.json", |
| 303 extension_manifest_errors::kLaunchNotAllowedForPlatformApps); |
| 304 LoadAndExpectError( |
| 305 "init_invalid_platform_app_2.json", |
| 306 extension_manifest_errors::kBackgroundRequiredForPlatformApps); |
300 } | 307 } |
301 | 308 |
302 TEST_F(ExtensionManifestTest, CertainApisRequirePlatformApps) { | 309 TEST_F(ExtensionManifestTest, CertainApisRequirePlatformApps) { |
303 // Put APIs here that should be restricted to platform apps, but that haven't | 310 // Put APIs here that should be restricted to platform apps, but that haven't |
304 // yet graduated from experimental. | 311 // yet graduated from experimental. |
305 const char* kPlatformAppExperimentalApis[] = { | 312 const char* kPlatformAppExperimentalApis[] = { |
306 "dns", | 313 "dns", |
307 "serial", | 314 "serial", |
308 "socket", | 315 "socket", |
309 }; | 316 }; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 errors::kInvalidLaunchValue, | 527 errors::kInvalidLaunchValue, |
521 keys::kLaunchWidth)); | 528 keys::kLaunchWidth)); |
522 LoadAndExpectError("launch_height_invalid.json", | 529 LoadAndExpectError("launch_height_invalid.json", |
523 ExtensionErrorUtils::FormatErrorMessage( | 530 ExtensionErrorUtils::FormatErrorMessage( |
524 errors::kInvalidLaunchValueContainer, | 531 errors::kInvalidLaunchValueContainer, |
525 keys::kLaunchHeight)); | 532 keys::kLaunchHeight)); |
526 LoadAndExpectError("launch_height_negative.json", | 533 LoadAndExpectError("launch_height_negative.json", |
527 ExtensionErrorUtils::FormatErrorMessage( | 534 ExtensionErrorUtils::FormatErrorMessage( |
528 errors::kInvalidLaunchValue, | 535 errors::kInvalidLaunchValue, |
529 keys::kLaunchHeight)); | 536 keys::kLaunchHeight)); |
530 | |
531 LoadAndExpectError("launch_min_width_invalid.json", | |
532 ExtensionErrorUtils::FormatErrorMessage( | |
533 errors::kInvalidLaunchValueContainer, | |
534 keys::kLaunchMinWidth)); | |
535 LoadAndExpectError("launch_min_width_negative.json", | |
536 ExtensionErrorUtils::FormatErrorMessage( | |
537 errors::kInvalidLaunchValue, | |
538 keys::kLaunchMinWidth)); | |
539 LoadAndExpectError("launch_min_height_invalid.json", | |
540 ExtensionErrorUtils::FormatErrorMessage( | |
541 errors::kInvalidLaunchValueContainer, | |
542 keys::kLaunchMinHeight)); | |
543 LoadAndExpectError("launch_min_height_negative.json", | |
544 ExtensionErrorUtils::FormatErrorMessage( | |
545 errors::kInvalidLaunchValue, | |
546 keys::kLaunchMinHeight)); | |
547 | |
548 LoadAndExpectError("launch_container_missing_size_for_platform.json", | |
549 ExtensionErrorUtils::FormatErrorMessage( | |
550 errors::kInvalidLaunchValue, | |
551 keys::kLaunchWidth)); | |
552 LoadAndExpectError("launch_container_invalid_size_constraints.json", | |
553 ExtensionErrorUtils::FormatErrorMessage( | |
554 errors::kInvalidLaunchValue, | |
555 keys::kLaunchMaxWidth)); | |
556 } | |
557 | |
558 TEST_F(ExtensionManifestTest, PlatformAppLaunchContainer) { | |
559 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); | |
560 | |
561 LoadAndExpectError("launch_container_invalid_type_for_platform.json", | |
562 errors::kInvalidLaunchContainerForPlatform); | |
563 } | 537 } |
564 | 538 |
565 TEST_F(ExtensionManifestTest, AppLaunchURL) { | 539 TEST_F(ExtensionManifestTest, AppLaunchURL) { |
566 LoadAndExpectError("launch_path_and_url.json", | 540 LoadAndExpectError("launch_path_and_url.json", |
567 errors::kLaunchPathAndURLAreExclusive); | 541 errors::kLaunchPathAndURLAreExclusive); |
568 LoadAndExpectError("launch_path_and_extent.json", | 542 LoadAndExpectError("launch_path_and_extent.json", |
569 errors::kLaunchPathAndExtentAreExclusive); | 543 errors::kLaunchPathAndExtentAreExclusive); |
570 LoadAndExpectError("launch_path_invalid_type.json", | 544 LoadAndExpectError("launch_path_invalid_type.json", |
571 ExtensionErrorUtils::FormatErrorMessage( | 545 ExtensionErrorUtils::FormatErrorMessage( |
572 errors::kInvalidLaunchValue, | 546 errors::kInvalidLaunchValue, |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 // Extension with manifest version 2 *can* use storage API. | 1244 // Extension with manifest version 2 *can* use storage API. |
1271 { | 1245 { |
1272 DictionaryValue manifest_with_version; | 1246 DictionaryValue manifest_with_version; |
1273 manifest_with_version.SetInteger(keys::kManifestVersion, 2); | 1247 manifest_with_version.SetInteger(keys::kManifestVersion, 2); |
1274 manifest_with_version.MergeDictionary(&base_manifest); | 1248 manifest_with_version.MergeDictionary(&base_manifest); |
1275 | 1249 |
1276 Manifest manifest(&manifest_with_version, "test"); | 1250 Manifest manifest(&manifest_with_version, "test"); |
1277 LoadAndExpectSuccess(manifest); | 1251 LoadAndExpectSuccess(manifest); |
1278 } | 1252 } |
1279 } | 1253 } |
OLD | NEW |