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

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

Issue 8654001: Reland 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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 ASCIIToUTF16("Default title")); 582 ASCIIToUTF16("Default title"));
583 EXPECT_EQ(extension->sidebar_defaults()->default_icon_path(), 583 EXPECT_EQ(extension->sidebar_defaults()->default_icon_path(),
584 "icon.png"); 584 "icon.png");
585 EXPECT_EQ(extension->url().spec() + "sidebar.html", 585 EXPECT_EQ(extension->url().spec() + "sidebar.html",
586 extension->sidebar_defaults()->default_page().spec()); 586 extension->sidebar_defaults()->default_page().spec());
587 } 587 }
588 588
589 TEST_F(ExtensionManifestTest, DisallowHybridApps) { 589 TEST_F(ExtensionManifestTest, DisallowHybridApps) {
590 LoadAndExpectError("disallow_hybrid_1.json", 590 LoadAndExpectError("disallow_hybrid_1.json",
591 ExtensionErrorUtils::FormatErrorMessage( 591 ExtensionErrorUtils::FormatErrorMessage(
592 errors::kHostedAppsCannotIncludeExtensionFeatures, 592 errors::kFeatureNotAllowed,
593 keys::kBrowserAction)); 593 keys::kBrowserAction));
594 LoadAndExpectError("disallow_hybrid_2.json", 594 LoadAndExpectError("disallow_hybrid_2.json",
595 errors::kBackgroundPermissionNeeded); 595 errors::kBackgroundPermissionNeeded);
596 } 596 }
597 597
598 TEST_F(ExtensionManifestTest, OptionsPageInApps) { 598 TEST_F(ExtensionManifestTest, OptionsPageInApps) {
599 scoped_refptr<Extension> extension; 599 scoped_refptr<Extension> extension;
600 600
601 // Allow options page with absolute URL in hosted apps. 601 // Allow options page with absolute URL in hosted apps.
602 extension = LoadAndExpectSuccess("hosted_app_absolute_options.json"); 602 extension = LoadAndExpectSuccess("hosted_app_absolute_options.json");
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 scoped_refptr<Extension> extension( 728 scoped_refptr<Extension> extension(
729 LoadAndExpectSuccess("normalize_icon_paths.json")); 729 LoadAndExpectSuccess("normalize_icon_paths.json"));
730 EXPECT_EQ("16.png", 730 EXPECT_EQ("16.png",
731 extension->icons().Get(16, ExtensionIconSet::MATCH_EXACTLY)); 731 extension->icons().Get(16, ExtensionIconSet::MATCH_EXACTLY));
732 EXPECT_EQ("48.png", 732 EXPECT_EQ("48.png",
733 extension->icons().Get(48, ExtensionIconSet::MATCH_EXACTLY)); 733 extension->icons().Get(48, ExtensionIconSet::MATCH_EXACTLY));
734 } 734 }
735 735
736 TEST_F(ExtensionManifestTest, DisallowMultipleUISurfaces) { 736 TEST_F(ExtensionManifestTest, DisallowMultipleUISurfaces) {
737 LoadAndExpectError("multiple_ui_surfaces_1.json", errors::kOneUISurfaceOnly); 737 LoadAndExpectError("multiple_ui_surfaces_1.json", errors::kOneUISurfaceOnly);
738 LoadAndExpectError("multiple_ui_surfaces_2.json", errors::kOneUISurfaceOnly); 738 LoadAndExpectError("multiple_ui_surfaces_2.json",
739 LoadAndExpectError("multiple_ui_surfaces_3.json", errors::kOneUISurfaceOnly); 739 ExtensionErrorUtils::FormatErrorMessage(
740 errors::kFeatureNotAllowed,
741 keys::kBrowserAction));
742 LoadAndExpectError("multiple_ui_surfaces_3.json",
743 ExtensionErrorUtils::FormatErrorMessage(
744 errors::kFeatureNotAllowed,
745 keys::kBrowserAction));
740 } 746 }
741 747
742 TEST_F(ExtensionManifestTest, ParseHomepageURLs) { 748 TEST_F(ExtensionManifestTest, ParseHomepageURLs) {
743 scoped_refptr<Extension> extension( 749 scoped_refptr<Extension> extension(
744 LoadAndExpectSuccess("homepage_valid.json")); 750 LoadAndExpectSuccess("homepage_valid.json"));
745 LoadAndExpectError("homepage_empty.json", 751 LoadAndExpectError("homepage_empty.json",
746 extension_manifest_errors::kInvalidHomepageURL); 752 extension_manifest_errors::kInvalidHomepageURL);
747 LoadAndExpectError("homepage_invalid.json", 753 LoadAndExpectError("homepage_invalid.json",
748 extension_manifest_errors::kInvalidHomepageURL); 754 extension_manifest_errors::kInvalidHomepageURL);
749 LoadAndExpectError("homepage_bad_schema.json", 755 LoadAndExpectError("homepage_bad_schema.json",
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 scoped_refptr<Extension> extension_2( 959 scoped_refptr<Extension> extension_2(
954 LoadAndExpectSuccess("offline_disabled_packaged_app.json")); 960 LoadAndExpectSuccess("offline_disabled_packaged_app.json"));
955 EXPECT_FALSE(extension_2->offline_enabled()); 961 EXPECT_FALSE(extension_2->offline_enabled());
956 scoped_refptr<Extension> extension_3( 962 scoped_refptr<Extension> extension_3(
957 LoadAndExpectSuccess("offline_default_packaged_app.json")); 963 LoadAndExpectSuccess("offline_default_packaged_app.json"));
958 EXPECT_FALSE(extension_3->offline_enabled()); 964 EXPECT_FALSE(extension_3->offline_enabled());
959 scoped_refptr<Extension> extension_4( 965 scoped_refptr<Extension> extension_4(
960 LoadAndExpectSuccess("offline_enabled_hosted_app.json")); 966 LoadAndExpectSuccess("offline_enabled_hosted_app.json"));
961 EXPECT_TRUE(extension_4->offline_enabled()); 967 EXPECT_TRUE(extension_4->offline_enabled());
962 } 968 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698