Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: chrome/common/extensions/extension_manifests_unittest.cc

Issue 8786004: Revert "Restrict extension features based on the extension type." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 scoped_refptr<Extension> extension(LoadAndExpectSuccess("sidebar.json")); 581 scoped_refptr<Extension> extension(LoadAndExpectSuccess("sidebar.json"));
582 ASSERT_TRUE(extension->sidebar_defaults() != NULL); 582 ASSERT_TRUE(extension->sidebar_defaults() != NULL);
583 EXPECT_EQ(extension->sidebar_defaults()->default_title(), 583 EXPECT_EQ(extension->sidebar_defaults()->default_title(),
584 ASCIIToUTF16("Default title")); 584 ASCIIToUTF16("Default title"));
585 EXPECT_EQ(extension->sidebar_defaults()->default_icon_path(), 585 EXPECT_EQ(extension->sidebar_defaults()->default_icon_path(),
586 "icon.png"); 586 "icon.png");
587 EXPECT_EQ(extension->url().spec() + "sidebar.html", 587 EXPECT_EQ(extension->url().spec() + "sidebar.html",
588 extension->sidebar_defaults()->default_page().spec()); 588 extension->sidebar_defaults()->default_page().spec());
589 } 589 }
590 590
591 TEST_F(ExtensionManifestTest, BackgroundPermission) { 591 TEST_F(ExtensionManifestTest, DisallowHybridApps) {
592 LoadAndExpectError("background_permission.json", 592 LoadAndExpectError("disallow_hybrid_1.json",
593 ExtensionErrorUtils::FormatErrorMessage(
594 errors::kHostedAppsCannotIncludeExtensionFeatures,
595 keys::kBrowserAction));
596 LoadAndExpectError("disallow_hybrid_2.json",
593 errors::kBackgroundPermissionNeeded); 597 errors::kBackgroundPermissionNeeded);
594 } 598 }
595 599
596 TEST_F(ExtensionManifestTest, OptionsPageInApps) { 600 TEST_F(ExtensionManifestTest, OptionsPageInApps) {
597 scoped_refptr<Extension> extension; 601 scoped_refptr<Extension> extension;
598 602
599 // Allow options page with absolute URL in hosted apps. 603 // Allow options page with absolute URL in hosted apps.
600 extension = LoadAndExpectSuccess("hosted_app_absolute_options.json"); 604 extension = LoadAndExpectSuccess("hosted_app_absolute_options.json");
601 EXPECT_STREQ("http", 605 EXPECT_STREQ("http",
602 extension->options_url().scheme().c_str()); 606 extension->options_url().scheme().c_str());
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 TEST_F(ExtensionManifestTest, NormalizeIconPaths) { 735 TEST_F(ExtensionManifestTest, NormalizeIconPaths) {
732 scoped_refptr<Extension> extension( 736 scoped_refptr<Extension> extension(
733 LoadAndExpectSuccess("normalize_icon_paths.json")); 737 LoadAndExpectSuccess("normalize_icon_paths.json"));
734 EXPECT_EQ("16.png", 738 EXPECT_EQ("16.png",
735 extension->icons().Get(16, ExtensionIconSet::MATCH_EXACTLY)); 739 extension->icons().Get(16, ExtensionIconSet::MATCH_EXACTLY));
736 EXPECT_EQ("48.png", 740 EXPECT_EQ("48.png",
737 extension->icons().Get(48, ExtensionIconSet::MATCH_EXACTLY)); 741 extension->icons().Get(48, ExtensionIconSet::MATCH_EXACTLY));
738 } 742 }
739 743
740 TEST_F(ExtensionManifestTest, DisallowMultipleUISurfaces) { 744 TEST_F(ExtensionManifestTest, DisallowMultipleUISurfaces) {
741 LoadAndExpectError("multiple_ui_surfaces.json", errors::kOneUISurfaceOnly); 745 LoadAndExpectError("multiple_ui_surfaces_1.json", errors::kOneUISurfaceOnly);
746 LoadAndExpectError("multiple_ui_surfaces_2.json", errors::kOneUISurfaceOnly);
747 LoadAndExpectError("multiple_ui_surfaces_3.json", errors::kOneUISurfaceOnly);
742 } 748 }
743 749
744 TEST_F(ExtensionManifestTest, ParseHomepageURLs) { 750 TEST_F(ExtensionManifestTest, ParseHomepageURLs) {
745 scoped_refptr<Extension> extension( 751 scoped_refptr<Extension> extension(
746 LoadAndExpectSuccess("homepage_valid.json")); 752 LoadAndExpectSuccess("homepage_valid.json"));
747 LoadAndExpectError("homepage_empty.json", 753 LoadAndExpectError("homepage_empty.json",
748 extension_manifest_errors::kInvalidHomepageURL); 754 extension_manifest_errors::kInvalidHomepageURL);
749 LoadAndExpectError("homepage_invalid.json", 755 LoadAndExpectError("homepage_invalid.json",
750 extension_manifest_errors::kInvalidHomepageURL); 756 extension_manifest_errors::kInvalidHomepageURL);
751 LoadAndExpectError("homepage_bad_schema.json", 757 LoadAndExpectError("homepage_bad_schema.json",
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 // This guy is identical to the previous but doesn't ask for any 994 // This guy is identical to the previous but doesn't ask for any
989 // platform-app-only permissions. We should be able to load him and ask 995 // platform-app-only permissions. We should be able to load him and ask
990 // questions about his permissions. 996 // questions about his permissions.
991 scoped_refptr<Extension> extension( 997 scoped_refptr<Extension> extension(
992 LoadAndExpectSuccess("not_platform_app.json")); 998 LoadAndExpectSuccess("not_platform_app.json"));
993 ExtensionAPIPermissionSet apis = extension->GetActivePermissions()->apis(); 999 ExtensionAPIPermissionSet apis = extension->GetActivePermissions()->apis();
994 for (ExtensionAPIPermissionSet::const_iterator i = apis.begin(); 1000 for (ExtensionAPIPermissionSet::const_iterator i = apis.begin();
995 i != apis.end(); ++i) 1001 i != apis.end(); ++i)
996 EXPECT_NE(platform_app, info->GetByID(*i)->type_restrictions()); 1002 EXPECT_NE(platform_app, info->GetByID(*i)->type_restrictions());
997 } 1003 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_constants.cc ('k') | chrome/common/extensions/extension_messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698