diff options
5 files changed, 68 insertions, 4 deletions
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc index e060b40..5d7aac7 100644 --- a/chrome/browser/extensions/extensions_service_unittest.cc +++ b/chrome/browser/extensions/extensions_service_unittest.cc @@ -962,6 +962,53 @@ TEST_F(ExtensionsServiceTest, InstallTheme) { ValidatePrefKeyCount(pref_count); } +TEST_F(ExtensionsServiceTest, LoadLocalizedTheme) { + // Load. + InitializeEmptyExtensionsService(); + FilePath extension_path; + ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extension_path)); + extension_path = extension_path + .AppendASCII("extensions") + .AppendASCII("theme_i18n"); + + service_->LoadExtension(extension_path); + loop_.RunAllPending(); + EXPECT_EQ(0u, GetErrors().size()); + ASSERT_EQ(1u, loaded_.size()); + EXPECT_EQ(1u, service_->extensions()->size()); + EXPECT_EQ("name", service_->extensions()->at(0)->name()); + EXPECT_EQ("description", service_->extensions()->at(0)->description()); +} + +TEST_F(ExtensionsServiceTest, InstallLocalizedTheme) { + // Pack. + InitializeEmptyExtensionsService(); + FilePath extension_path; + ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extension_path)); + extension_path = extension_path + .AppendASCII("extensions") + .AppendASCII("theme_i18n"); + + FilePath crx_path; + ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &crx_path)); + crx_path = crx_path.AppendASCII("theme.crx"); + FilePath pem_path = crx_path.DirName().AppendASCII("theme.pem"); + + ASSERT_TRUE(file_util::Delete(crx_path, false)); + ASSERT_TRUE(file_util::Delete(pem_path, false)); + scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); + ASSERT_TRUE(creator->Run(extension_path, crx_path, FilePath(), pem_path)); + ASSERT_TRUE(file_util::PathExists(crx_path)); + + // Install. + service_->UnloadAllExtensions(); + InstallExtension(crx_path, true); + EXPECT_EQ(0u, GetErrors().size()); + EXPECT_EQ(1u, service_->extensions()->size()); + EXPECT_EQ("name", service_->extensions()->at(0)->name()); + EXPECT_EQ("description", service_->extensions()->at(0)->description()); +} + TEST_F(ExtensionsServiceTest, InstallApps) { InitializeEmptyExtensionsService(); FilePath extensions_path; diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 4a6bac3..a5780c2 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -92,6 +92,8 @@ const FilePath::CharType Extension::kMessagesFilename[] = // A list of all the keys allowed by themes. static const wchar_t* kValidThemeKeys[] = { + keys::kCurrentLocale, + keys::kDefaultLocale, keys::kDescription, keys::kName, keys::kPublicKey, diff --git a/chrome/common/extensions/extension_l10n_util.cc b/chrome/common/extensions/extension_l10n_util.cc index 2848d8f..b9c2b1c 100644 --- a/chrome/common/extensions/extension_l10n_util.cc +++ b/chrome/common/extensions/extension_l10n_util.cc @@ -79,10 +79,6 @@ static bool LocalizeManifestValue(const std::wstring& key, bool LocalizeManifest(const ExtensionMessageBundle& messages, DictionaryValue* manifest, std::string* error) { - // Don't localize themes. - if (manifest->HasKey(keys::kTheme)) - return true; - // Initialize name. std::string result; if (!manifest->GetString(keys::kName, &result)) { diff --git a/chrome/test/data/extensions/theme_i18n/_locales/en/messages.json b/chrome/test/data/extensions/theme_i18n/_locales/en/messages.json new file mode 100644 index 0000000..544e460 --- /dev/null +++ b/chrome/test/data/extensions/theme_i18n/_locales/en/messages.json @@ -0,0 +1,8 @@ +{ + "name": { + "message": "name" + }, + "description": { + "message": "description" + } +} diff --git a/chrome/test/data/extensions/theme_i18n/manifest.json b/chrome/test/data/extensions/theme_i18n/manifest.json new file mode 100644 index 0000000..c35276e --- /dev/null +++ b/chrome/test/data/extensions/theme_i18n/manifest.json @@ -0,0 +1,11 @@ +{ + "name": "__MSG_name__", + "description": "__MSG_description__", + "version": "1", + "default_locale": "en", + "theme": { + "properties" : { + "ntp_background_alignment" : "top" + } + } +} |