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

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

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
Index: chrome/common/extensions/extension_l10n_util.h
diff --git a/chrome/common/extensions/extension_l10n_util.h b/chrome/common/extensions/extension_l10n_util.h
index a0806938b7f81d7a2f064fe1c271f187fbe1247b..24178a076fc4b583dd46733a61a12aa3957eb579 100644
--- a/chrome/common/extensions/extension_l10n_util.h
+++ b/chrome/common/extensions/extension_l10n_util.h
@@ -107,6 +107,24 @@ bool ShouldSkipValidation(const FilePath& locales_path,
const FilePath& locale_path,
const std::set<std::string>& all_locales);
+// Sets the process locale for the duration of the current scope, then reverts
+// back to whatever the current locale was before constructing this.
+// For testing purposed only!
+class ScopedLocaleForTest {
+ public:
+ // Only revert back to current locale at end of scope, don't set locale.
+ ScopedLocaleForTest();
+
+ // Set temporary locale for the current scope
+ explicit ScopedLocaleForTest(const std::string& locale);
+
+ ~ScopedLocaleForTest();
+
+ private:
+ std::string locale_; // The current locale at ctor time.
+};
+
+
} // namespace extension_l10n_util
#endif // CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_
« no previous file with comments | « chrome/browser/intents/cws_intents_registry_unittest.cc ('k') | chrome/common/extensions/extension_l10n_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698