| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 EXPECT_EQ("", UTF16ToUTF8(extension->intents_services()[0].title)); | 837 EXPECT_EQ("", UTF16ToUTF8(extension->intents_services()[0].title)); |
| 838 EXPECT_EQ(webkit_glue::WebIntentServiceData::DISPOSITION_WINDOW, | 838 EXPECT_EQ(webkit_glue::WebIntentServiceData::DISPOSITION_WINDOW, |
| 839 extension->intents_services()[0].disposition); | 839 extension->intents_services()[0].disposition); |
| 840 } | 840 } |
| 841 | 841 |
| 842 TEST_F(ExtensionManifestTest, PortsInPermissions) { | 842 TEST_F(ExtensionManifestTest, PortsInPermissions) { |
| 843 // Loading as a user would shoud not trigger an error. | 843 // Loading as a user would shoud not trigger an error. |
| 844 LoadAndExpectSuccess("ports_in_permissions.json"); | 844 LoadAndExpectSuccess("ports_in_permissions.json"); |
| 845 } | 845 } |
| 846 | 846 |
| 847 TEST_F(ExtensionManifestTest, WebAccessibleResources) { |
| 848 // Manifest version 2 with web accessible resources specified. |
| 849 scoped_refptr<Extension> extension1( |
| 850 LoadAndExpectSuccess("web_accessible_resources_1.json")); |
| 851 |
| 852 // Manifest version 2 with no web accessible resources. |
| 853 scoped_refptr<Extension> extension2( |
| 854 LoadAndExpectSuccess("web_accessible_resources_2.json")); |
| 855 |
| 856 // Default manifest version with web accessible resources specified. |
| 857 scoped_refptr<Extension> extension3( |
| 858 LoadAndExpectSuccess("web_accessible_resources_3.json")); |
| 859 |
| 860 // Default manifest version with no web accessible resources. |
| 861 scoped_refptr<Extension> extension4( |
| 862 LoadAndExpectSuccess("web_accessible_resources_4.json")); |
| 863 |
| 864 EXPECT_TRUE(extension1->HasWebAccessibleResources()); |
| 865 EXPECT_FALSE(extension2->HasWebAccessibleResources()); |
| 866 EXPECT_TRUE(extension3->HasWebAccessibleResources()); |
| 867 EXPECT_FALSE(extension4->HasWebAccessibleResources()); |
| 868 |
| 869 EXPECT_TRUE(extension1->IsResourceWebAccessible("/test")); |
| 870 EXPECT_FALSE(extension1->IsResourceWebAccessible("/none")); |
| 871 |
| 872 EXPECT_FALSE(extension2->IsResourceWebAccessible("/test")); |
| 873 |
| 874 EXPECT_TRUE(extension3->IsResourceWebAccessible("/test")); |
| 875 EXPECT_FALSE(extension3->IsResourceWebAccessible("/none")); |
| 876 |
| 877 EXPECT_TRUE(extension4->IsResourceWebAccessible("/test")); |
| 878 EXPECT_TRUE(extension4->IsResourceWebAccessible("/none")); |
| 879 } |
| 880 |
| 847 TEST_F(ExtensionManifestTest, IsolatedApps) { | 881 TEST_F(ExtensionManifestTest, IsolatedApps) { |
| 848 // Requires --enable-experimental-extension-apis | 882 // Requires --enable-experimental-extension-apis |
| 849 LoadAndExpectError("isolated_app_valid.json", | 883 LoadAndExpectError("isolated_app_valid.json", |
| 850 errors::kExperimentalFlagRequired); | 884 errors::kExperimentalFlagRequired); |
| 851 | 885 |
| 852 CommandLine::ForCurrentProcess()->AppendSwitch( | 886 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 853 switches::kEnableExperimentalExtensionApis); | 887 switches::kEnableExperimentalExtensionApis); |
| 854 scoped_refptr<Extension> extension2( | 888 scoped_refptr<Extension> extension2( |
| 855 LoadAndExpectSuccess("isolated_app_valid.json")); | 889 LoadAndExpectSuccess("isolated_app_valid.json")); |
| 856 EXPECT_TRUE(extension2->is_storage_isolated()); | 890 EXPECT_TRUE(extension2->is_storage_isolated()); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 // This guy is identical to the previous but doesn't ask for any | 990 // This guy is identical to the previous but doesn't ask for any |
| 957 // platform-app-only permissions. We should be able to load him and ask | 991 // platform-app-only permissions. We should be able to load him and ask |
| 958 // questions about his permissions. | 992 // questions about his permissions. |
| 959 scoped_refptr<Extension> extension( | 993 scoped_refptr<Extension> extension( |
| 960 LoadAndExpectSuccess("not_platform_app.json")); | 994 LoadAndExpectSuccess("not_platform_app.json")); |
| 961 ExtensionAPIPermissionSet apis = extension->GetActivePermissions()->apis(); | 995 ExtensionAPIPermissionSet apis = extension->GetActivePermissions()->apis(); |
| 962 for (ExtensionAPIPermissionSet::const_iterator i = apis.begin(); | 996 for (ExtensionAPIPermissionSet::const_iterator i = apis.begin(); |
| 963 i != apis.end(); ++i) | 997 i != apis.end(); ++i) |
| 964 EXPECT_NE(platform_app, info->GetByID(*i)->type_restrictions()); | 998 EXPECT_NE(platform_app, info->GetByID(*i)->type_restrictions()); |
| 965 } | 999 } |
| OLD | NEW |