summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/extension_manifests_unittest.cc
diff options
context:
space:
mode:
authorskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-01 04:34:33 +0000
committerskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-01 04:34:33 +0000
commit270979d4c618381a522a556b806cf77401b7b8ea (patch)
tree7c7044661bb07dfc353327e2fe8d07d88296d5b7 /chrome/common/extensions/extension_manifests_unittest.cc
parented8e0b79a461266a00cedd0e88d136ba2e38b8a4 (diff)
downloadchromium_src-270979d4c618381a522a556b806cf77401b7b8ea.zip
chromium_src-270979d4c618381a522a556b806cf77401b7b8ea.tar.gz
chromium_src-270979d4c618381a522a556b806cf77401b7b8ea.tar.bz2
Allow options pages for hosted apps to be external.
BUG=53155 TEST=ExtensionManifestTet.OptionsPageInApps Review URL: http://codereview.chromium.org/3222008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58125 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension_manifests_unittest.cc')
-rw-r--r--chrome/common/extensions/extension_manifests_unittest.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc
index 5593b72..42c994c 100644
--- a/chrome/common/extensions/extension_manifests_unittest.cc
+++ b/chrome/common/extensions/extension_manifests_unittest.cc
@@ -283,6 +283,32 @@ TEST_F(ExtensionManifestTest, DisallowHybridApps) {
errors::kHostedAppsCannotIncludeExtensionFeatures);
}
+TEST_F(ExtensionManifestTest, OptionsPageInApps) {
+ scoped_ptr<Extension> extension;
+
+ // Allow options page with absolute URL in hosed apps.
+ extension.reset(
+ LoadAndExpectSuccess("hosted_app_absolute_options.json"));
+ EXPECT_STREQ("http",
+ extension->options_url().scheme().c_str());
+ EXPECT_STREQ("example.com",
+ extension->options_url().host().c_str());
+ EXPECT_STREQ("options.html",
+ extension->options_url().ExtractFileName().c_str());
+
+ // Forbid options page with relative URL in hosted apps.
+ LoadAndExpectError("hosted_app_relative_options.json",
+ errors::kInvalidOptionsPageInHostedApp);
+
+ // Forbid options page with non-(http|https) scheme in hosted app.
+ LoadAndExpectError("hosted_app_file_options.json",
+ errors::kInvalidOptionsPageInHostedApp);
+
+ // Forbid absolute URL for options page in packaged apps.
+ LoadAndExpectError("packaged_app_absolute_options.json",
+ errors::kInvalidOptionsPageExpectUrlInPackage);
+}
+
TEST_F(ExtensionManifestTest, DisallowExtensionPermissions) {
std::string error;
scoped_ptr<DictionaryValue> manifest(