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

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

Issue 521036: Add a "minimum_chrome_version" key to the manifest. (Closed)
Patch Set: Removed extraneous change, added new test, added docs Created 10 years, 11 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension_unittest.cc
diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc
index db992ebd688d4fc3484e93c493a446a6dedd1e13..677e1f80263621e24ddc8136d5218f9222d814ee 100644
--- a/chrome/common/extensions/extension_unittest.cc
+++ b/chrome/common/extensions/extension_unittest.cc
@@ -23,8 +23,7 @@ namespace errors = extension_manifest_errors;
class ExtensionTest : public testing::Test {
};
-// TODO(mad): http://crbug.com/26214
-TEST(ExtensionTest, DISABLED_InitFromValueInvalid) {
+TEST(ExtensionTest, InitFromValueInvalid) {
#if defined(OS_WIN)
FilePath path(FILE_PATH_LITERAL("c:\\foo"));
#elif defined(OS_POSIX)
@@ -251,6 +250,17 @@ TEST(ExtensionTest, DISABLED_InitFromValueInvalid) {
input_value->Set(keys::kDefaultLocale, Value::CreateStringValue(""));
EXPECT_FALSE(extension.InitFromValue(*input_value, true, &error));
EXPECT_TRUE(MatchPatternASCII(error, errors::kInvalidDefaultLocale));
+
+ // Test invalid minimum_chrome_version.
+ input_value.reset(static_cast<DictionaryValue*>(valid_value->DeepCopy()));
+ input_value->Set(keys::kMinimumChromeVersion, Value::CreateIntegerValue(42));
+ EXPECT_FALSE(extension.InitFromValue(*input_value, true, &error));
+ EXPECT_TRUE(MatchPatternASCII(error, errors::kInvalidMinimumChromeVersion));
+
+ input_value->Set(keys::kMinimumChromeVersion,
+ Value::CreateStringValue("88.8"));
+ EXPECT_FALSE(extension.InitFromValue(*input_value, true, &error));
+ EXPECT_TRUE(MatchPatternASCII(error, errors::kChromeVersionTooLow));
}
TEST(ExtensionTest, InitFromValueValid) {
@@ -281,6 +291,12 @@ TEST(ExtensionTest, InitFromValueValid) {
EXPECT_EQ("", error);
EXPECT_EQ("chrome-extension", extension.options_url().scheme());
EXPECT_EQ("/options.html", extension.options_url().path());
+
+ // Test with a minimum_chrome_version.
+ input_value.SetString(keys::kMinimumChromeVersion, "1.0");
+ EXPECT_TRUE(extension.InitFromValue(input_value, false, &error));
+ EXPECT_EQ("", error);
+ // The minimum chrome version is not stored in the Extension object.
}
TEST(ExtensionTest, GetResourceURLAndPath) {
« no previous file with comments | « chrome/common/extensions/extension_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698