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

Unified Diff: chrome/common/extensions/extension_unittest.cc

Issue 271114: Add concept of an options page to Extensions.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/extension_constants.cc ('k') | chrome/test/data/extensions/options.crx » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension_unittest.cc
===================================================================
--- chrome/common/extensions/extension_unittest.cc (revision 29288)
+++ chrome/common/extensions/extension_unittest.cc (working copy)
@@ -231,6 +231,12 @@
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 @@
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) {
« no previous file with comments | « chrome/common/extensions/extension_constants.cc ('k') | chrome/test/data/extensions/options.crx » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698