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

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

Issue 9421010: Allow app launch URLs to be localized. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit Created 8 years, 10 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/common/extensions/extension_l10n_util_unittest.cc
diff --git a/chrome/common/extensions/extension_l10n_util_unittest.cc b/chrome/common/extensions/extension_l10n_util_unittest.cc
index 52aabd563e2be160d8abab6ed5d6eee8e76666d2..783ddb48e817cb8a5c0ffaf0be8a7fad934f2368 100644
--- a/chrome/common/extensions/extension_l10n_util_unittest.cc
+++ b/chrome/common/extensions/extension_l10n_util_unittest.cc
@@ -281,6 +281,14 @@ ExtensionMessageBundle* CreateManifestBundle() {
file_handler_title_tree->SetString("message", "file handler title");
catalog->Set("file_handler_title", file_handler_title_tree);
+ DictionaryValue* launch_local_path_tree = new DictionaryValue();
+ launch_local_path_tree->SetString("message", "main.html");
+ catalog->Set("launch_local_path", launch_local_path_tree);
+
+ DictionaryValue* launch_web_url_tree = new DictionaryValue();
+ launch_web_url_tree->SetString("message", "http://www.google.com/");
+ catalog->Set("launch_web_url", launch_web_url_tree);
+
std::vector<linked_ptr<DictionaryValue> > catalogs;
catalogs.push_back(catalog);
@@ -339,6 +347,40 @@ TEST(ExtensionL10nUtil, LocalizeManifestWithNameMsgAndEmptyDescription) {
EXPECT_TRUE(error.empty());
}
+TEST(ExtensionL10nUtil, LocalizeManifestWithLocalLaunchURL) {
+ DictionaryValue manifest;
+ manifest.SetString(keys::kName, "name");
+ manifest.SetString(keys::kLaunchLocalPath, "__MSG_launch_local_path__");
+ std::string error;
+ scoped_ptr<ExtensionMessageBundle> messages(CreateManifestBundle());
+
+ EXPECT_TRUE(
+ extension_l10n_util::LocalizeManifest(*messages, &manifest, &error));
+
+ std::string result;
+ ASSERT_TRUE(manifest.GetString(keys::kLaunchLocalPath, &result));
+ EXPECT_EQ("main.html", result);
+
+ EXPECT_TRUE(error.empty());
+}
+
+TEST(ExtensionL10nUtil, LocalizeManifestWithHostedLaunchURL) {
+ DictionaryValue manifest;
+ manifest.SetString(keys::kName, "name");
+ manifest.SetString(keys::kLaunchWebURL, "__MSG_launch_web_url__");
+ std::string error;
+ scoped_ptr<ExtensionMessageBundle> messages(CreateManifestBundle());
+
+ EXPECT_TRUE(
+ extension_l10n_util::LocalizeManifest(*messages, &manifest, &error));
+
+ std::string result;
+ ASSERT_TRUE(manifest.GetString(keys::kLaunchWebURL, &result));
+ EXPECT_EQ("http://www.google.com/", result);
+
+ EXPECT_TRUE(error.empty());
+}
+
TEST(ExtensionL10nUtil, LocalizeManifestWithBadNameMsg) {
DictionaryValue manifest;
manifest.SetString(keys::kName, "__MSG_name_is_bad__");
« no previous file with comments | « chrome/common/extensions/extension_l10n_util.cc ('k') | chrome/common/extensions/extension_manifests_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698