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

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

Issue 526012: Merge 32345 - Parse messages.json in ExtensionUnpacker (like we do for manife... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/249/src/
Patch Set: Created 10 years, 12 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/common/extensions/extension_unpacker.h » ('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 35541)
+++ chrome/common/extensions/extension_unittest.cc (working copy)
@@ -49,6 +49,7 @@
ASSERT_TRUE(valid_value.get());
ASSERT_TRUE(extension.InitFromValue(*valid_value, true, &error));
ASSERT_EQ("", error);
+ EXPECT_EQ("en_US", extension.default_locale());
scoped_ptr<DictionaryValue> input_value;
@@ -238,6 +239,16 @@
input_value->Set(keys::kOptionsPage, Value::CreateNullValue());
EXPECT_FALSE(extension.InitFromValue(*input_value, true, &error));
EXPECT_TRUE(MatchPattern(error, errors::kInvalidOptionsPage));
+
+ // Test invalid/empty default locale.
+ input_value.reset(static_cast<DictionaryValue*>(valid_value->DeepCopy()));
+ input_value->Set(keys::kDefaultLocale, Value::CreateIntegerValue(5));
+ EXPECT_FALSE(extension.InitFromValue(*input_value, true, &error));
+ EXPECT_TRUE(MatchPattern(error, errors::kInvalidDefaultLocale));
+
+ input_value->Set(keys::kDefaultLocale, Value::CreateStringValue(""));
+ EXPECT_FALSE(extension.InitFromValue(*input_value, true, &error));
+ EXPECT_TRUE(MatchPattern(error, errors::kInvalidDefaultLocale));
}
TEST(ExtensionTest, InitFromValueValid) {
« no previous file with comments | « chrome/common/extensions/extension_constants.cc ('k') | chrome/common/extensions/extension_unpacker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698