diff options
author | asargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-16 18:34:28 +0000 |
---|---|---|
committer | asargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-16 18:34:28 +0000 |
commit | 43919ac90f426c807da507d52c163972634c771e (patch) | |
tree | 29d4053f433b61e587fa532428cb3dc4b11823de /chrome/common/extensions/extension_unittest.cc | |
parent | 29f192ded5a521a42ff1f93880e0787f2500d5a0 (diff) | |
download | chromium_src-43919ac90f426c807da507d52c163972634c771e.zip chromium_src-43919ac90f426c807da507d52c163972634c771e.tar.gz chromium_src-43919ac90f426c807da507d52c163972634c771e.tar.bz2 |
Add concept of an options page to Extensions.
BUG=23801
TEST=Create an extension with an "options_page" entry in its manifest with a value the name of a html file in the extension dir.
Load that extension and go to chrome://extensions, there should be an "Options" button that takes you to the page specified in the manifest.
Review URL: http://codereview.chromium.org/271114
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29297 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension_unittest.cc')
-rw-r--r-- | chrome/common/extensions/extension_unittest.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc index 104ce7a..eeb4499 100644 --- a/chrome/common/extensions/extension_unittest.cc +++ b/chrome/common/extensions/extension_unittest.cc @@ -231,6 +231,12 @@ TEST(ExtensionTest, InitFromValueInvalid) { input_value->Set(keys::kBrowserAction, action); EXPECT_FALSE(extension.InitFromValue(*input_value, true, &error)); EXPECT_STREQ(error.c_str(), errors::kOneUISurfaceOnly); + + // Test invalid options page url. + input_value.reset(static_cast<DictionaryValue*>(valid_value->DeepCopy())); + input_value->Set(keys::kOptionsPage, Value::CreateNullValue()); + EXPECT_FALSE(extension.InitFromValue(*input_value, true, &error)); + EXPECT_TRUE(MatchPattern(error, errors::kInvalidOptionsPage)); } TEST(ExtensionTest, InitFromValueValid) { @@ -254,6 +260,13 @@ TEST(ExtensionTest, InitFromValueValid) { EXPECT_EQ("my extension", extension.name()); EXPECT_EQ(extension.id(), extension.url().host()); EXPECT_EQ(path.value(), extension.path().value()); + + // Test with an options page. + input_value.SetString(keys::kOptionsPage, "options.html"); + EXPECT_TRUE(extension.InitFromValue(input_value, false, &error)); + EXPECT_EQ("", error); + EXPECT_EQ("chrome-extension", extension.options_url().scheme()); + EXPECT_EQ("/options.html", extension.options_url().path()); } TEST(ExtensionTest, GetResourceURLAndPath) { |