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

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

Issue 256022: Loads local resources from current locale subtree if available, if not it fal... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/browser/extensions/extension_l10n_util.cc ('k') | chrome/browser/extensions/extension_protocols.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_l10n_util_unittest.cc
===================================================================
--- chrome/browser/extensions/extension_l10n_util_unittest.cc (revision 28272)
+++ chrome/browser/extensions/extension_l10n_util_unittest.cc (working copy)
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/extension_l10n_util.h"
+#include "app/l10n_util.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
@@ -143,4 +144,34 @@
EXPECT_TRUE(error.empty());
}
+bool PathsAreEqual(const FilePath& path1, const FilePath& path2) {
+ FilePath::StringType path1_str = path1.value();
+ std::replace(path1_str.begin(), path1_str.end(), '\\', '/');
+
+ FilePath::StringType path2_str = path2.value();
+ std::replace(path2_str.begin(), path2_str.end(), '\\', '/');
+
+ if (path1_str == path2_str) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+TEST(ExtensionL10nUtil, GetL10nRelativePath) {
+ static std::string current_locale = l10n_util::GetApplicationLocale(L"");
+ std::replace(current_locale.begin(), current_locale.end(), '-', '_');
+
+ FilePath locale_path;
+ locale_path = locale_path
+ .AppendASCII(Extension::kLocaleFolder)
+ .AppendASCII(current_locale)
+ .AppendASCII("foo")
+ .AppendASCII("bar.js");
+
+ FilePath result = extension_l10n_util::GetL10nRelativePath(
+ FilePath(FILE_PATH_LITERAL("foo/bar.js")));
+ EXPECT_TRUE(PathsAreEqual(locale_path, result));
+}
+
} // namespace
« no previous file with comments | « chrome/browser/extensions/extension_l10n_util.cc ('k') | chrome/browser/extensions/extension_protocols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698