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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file declares extension specific l10n utils. 5 // This file declares extension specific l10n utils.
6 6
7 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ 7 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_
8 #define CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ 8 #define CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_
9 9
10 #include <set> 10 #include <set>
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 // Returns true if directory has "." in the name (for .svn) or if it doesn't 101 // Returns true if directory has "." in the name (for .svn) or if it doesn't
102 // belong to Chrome locales. 102 // belong to Chrome locales.
103 // |locales_path| is extension_id/_locales 103 // |locales_path| is extension_id/_locales
104 // |locale_path| is extension_id/_locales/xx 104 // |locale_path| is extension_id/_locales/xx
105 // |all_locales| is a set of all valid Chrome locales. 105 // |all_locales| is a set of all valid Chrome locales.
106 bool ShouldSkipValidation(const FilePath& locales_path, 106 bool ShouldSkipValidation(const FilePath& locales_path,
107 const FilePath& locale_path, 107 const FilePath& locale_path,
108 const std::set<std::string>& all_locales); 108 const std::set<std::string>& all_locales);
109 109
110 // Sets the process locale for the duration of the current scope, then reverts
111 // back to whatever the current locale was before constructing this.
112 // For testing purposed only!
113 class ScopedLocaleForTest {
114 public:
115 // Only revert back to current locale at end of scope, don't set locale.
116 ScopedLocaleForTest();
117
118 // Set temporary locale for the current scope
119 explicit ScopedLocaleForTest(const std::string& locale);
120
121 ~ScopedLocaleForTest();
122
123 private:
124 std::string locale_; // The current locale at ctor time.
125 };
126
127
110 } // namespace extension_l10n_util 128 } // namespace extension_l10n_util
111 129
112 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_ 130 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_L10N_UTIL_H_
OLDNEW
« 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