diff options
author | cira@chromium.org <cira@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 20:45:14 +0000 |
---|---|---|
committer | cira@chromium.org <cira@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 20:45:14 +0000 |
commit | 300cc58db6bc8d78e279dc07c46f15d9702148c6 (patch) | |
tree | 01eb9d8585bc43b01850c226bc4d5f2a3ec00cea /chrome/common/extensions/extension_unittest.cc | |
parent | cceaf1fbf3f4963c59a49268217f1e3edfb372ef (diff) | |
download | chromium_src-300cc58db6bc8d78e279dc07c46f15d9702148c6.zip chromium_src-300cc58db6bc8d78e279dc07c46f15d9702148c6.tar.gz chromium_src-300cc58db6bc8d78e279dc07c46f15d9702148c6.tar.bz2 |
This change enables Chrome to load locale information for the extension. It detects default locale, and filters out all locales not supported
by Chrome or with invalid names/missing messages.
It also checks for folders that start with _ and are not in the reserved list.
We don't validate messages file with this CL.
Added support for loading supplied locale information to the extension_file_util, and detecting default locale.
Added new constants to extension class (_locales directory name, messages filename).
Added new error messages to _constants.
Added new unittests.
BUG=12131
TEST=There should be no visible changes, except in case of error when loading extension (e.g. create empty _locales folder and try loading).
Review URL: http://codereview.chromium.org/170015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension_unittest.cc')
-rw-r--r-- | chrome/common/extensions/extension_unittest.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc index fc97cc1..10edbbb 100644 --- a/chrome/common/extensions/extension_unittest.cc +++ b/chrome/common/extensions/extension_unittest.cc @@ -231,6 +231,12 @@ TEST(ExtensionTest, InitFromValueInvalid) { privacy_blacklists->Set(0, Value::CreateIntegerValue(42)); EXPECT_FALSE(extension.InitFromValue(*input_value, true, &error)); EXPECT_TRUE(MatchPattern(error, errors::kInvalidPrivacyBlacklistsPath)); + + // Test invalid default locale. + input_value.reset(static_cast<DictionaryValue*>(valid_value->DeepCopy())); + input_value->SetInteger(keys::kDefaultLocale, 42); + EXPECT_FALSE(extension.InitFromValue(*input_value, true, &error)); + EXPECT_EQ(errors::kInvalidDefaultLocale, error); } TEST(ExtensionTest, InitFromValueValid) { |