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

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

Issue 10837130: Set locale for extension tests, keep it from affecting global state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « chrome/common/extensions/extension_l10n_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension_l10n_util.cc
diff --git a/chrome/common/extensions/extension_l10n_util.cc b/chrome/common/extensions/extension_l10n_util.cc
index f8617888d0d31be661a5d6cb8fcf317fb2c8965c..22c6ddf5577062b3402645acba33a33182998eca 100644
--- a/chrome/common/extensions/extension_l10n_util.cc
+++ b/chrome/common/extensions/extension_l10n_util.cc
@@ -354,4 +354,16 @@ bool ShouldSkipValidation(const FilePath& locales_path,
return false;
}
+ScopedLocaleForTest::ScopedLocaleForTest()
+ : locale_(extension_l10n_util::CurrentLocaleOrDefault()) {}
+
+ScopedLocaleForTest::ScopedLocaleForTest(const std::string& locale)
+ : locale_(extension_l10n_util::CurrentLocaleOrDefault()) {
+ extension_l10n_util::SetProcessLocale(locale);
+}
+
+ScopedLocaleForTest::~ScopedLocaleForTest() {
+ extension_l10n_util::SetProcessLocale(locale_);
+}
+
} // namespace extension_l10n_util
« no previous file with comments | « chrome/common/extensions/extension_l10n_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698