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

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

Issue 671011: All platforms don't support same locales at the same time. Make locale check ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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_l10n_util.cc ('k') | chrome/common/extensions/extension_unpacker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension_l10n_util_unittest.cc
===================================================================
--- chrome/common/extensions/extension_l10n_util_unittest.cc (revision 40922)
+++ chrome/common/extensions/extension_l10n_util_unittest.cc (working copy)
@@ -56,6 +56,33 @@
EXPECT_TRUE(locales.empty());
}
+TEST(ExtensionL10nUtil, GetValidLocalesWithUnsupportedLocale) {
+ ScopedTempDir temp;
+ ASSERT_TRUE(temp.CreateUniqueTempDir());
+
+ FilePath src_path = temp.path().Append(Extension::kLocaleFolder);
+ ASSERT_TRUE(file_util::CreateDirectory(src_path));
+ // Supported locale.
+ FilePath locale_1 = src_path.AppendASCII("sr");
+ ASSERT_TRUE(file_util::CreateDirectory(locale_1));
+ std::string data("whatever");
+ ASSERT_TRUE(file_util::WriteFile(
+ locale_1.Append(Extension::kMessagesFilename),
+ data.c_str(), data.length()));
+ // Unsupported locale.
+ ASSERT_TRUE(file_util::CreateDirectory(src_path.AppendASCII("xxx_yyy")));
+
+ std::string error;
+ std::set<std::string> locales;
+ EXPECT_TRUE(extension_l10n_util::GetValidLocales(src_path,
+ &locales,
+ &error));
+
+ EXPECT_FALSE(locales.empty());
+ EXPECT_TRUE(locales.find("sr") != locales.end());
+ EXPECT_FALSE(locales.find("xxx_yyy") != locales.end());
+}
+
TEST(ExtensionL10nUtil, GetValidLocalesWithValidLocalesAndMessagesFile) {
FilePath install_dir;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &install_dir));
« no previous file with comments | « chrome/common/extensions/extension_l10n_util.cc ('k') | chrome/common/extensions/extension_unpacker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698