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

Unified Diff: chrome/browser/extensions/extension_file_util_unittest.cc

Issue 173487: Implemented the rest of loading/parsing logic for extension i18n:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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
Index: chrome/browser/extensions/extension_file_util_unittest.cc
===================================================================
--- chrome/browser/extensions/extension_file_util_unittest.cc (revision 24127)
+++ chrome/browser/extensions/extension_file_util_unittest.cc (working copy)
@@ -117,7 +117,8 @@
DictionaryValue manifest;
manifest.SetString(keys::kVersion, "1.0.0.0");
- manifest.SetString(keys::kName, "my extension");
+ manifest.SetString(keys::kName, "__MSG_name__");
+ manifest.SetString(keys::kDescription, "__MSG_description__");
if (!locale.empty()) {
manifest.SetString(keys::kDefaultLocale, locale);
}
@@ -138,7 +139,8 @@
FilePath locale_1 = src_path.AppendASCII("sr");
ASSERT_TRUE(file_util::CreateDirectory(locale_1));
- std::string data = "foobar";
+ std::string data = "{ \"name\": { \"message\": \"foobar\" },"
+ "\"description\": { \"message\": \"nice going\" } }";
ASSERT_TRUE(
file_util::WriteFile(locale_1.AppendASCII(Extension::kMessagesFilename),
data.c_str(), data.length()));
@@ -154,9 +156,10 @@
scoped_ptr<Extension> extension(
extension_file_util::LoadExtension(temp.path(), false, &error));
ASSERT_FALSE(extension == NULL);
- EXPECT_EQ(static_cast<unsigned int>(2),
- extension->supported_locales().size());
+ EXPECT_EQ(2U, extension->supported_locales().size());
EXPECT_EQ("en-US", extension->default_locale());
+ EXPECT_EQ("foobar", extension->name());
+ EXPECT_EQ("nice going", extension->description());
}
TEST(ExtensionFileUtil, LoadExtensionWithoutLocalesFolder) {
@@ -180,7 +183,7 @@
FilePath src_path = temp.path().AppendASCII("some_dir");
ASSERT_TRUE(file_util::CreateDirectory(src_path));
- std::string data = "foobar";
+ std::string data = "{ \"name\": { \"message\": \"foobar\" } }";
ASSERT_TRUE(file_util::WriteFile(src_path.AppendASCII("some_file.txt"),
data.c_str(), data.length()));
std::string error;

Powered by Google App Engine
This is Rietveld 408576698