• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_TEST_ICU_TEST_UTIL_H_
6 #define BASE_TEST_ICU_TEST_UTIL_H_
7 
8 #include <string>
9 
10 #include "base/macros.h"
11 
12 namespace base {
13 namespace test {
14 
15 // In unit tests, prefer ScopedRestoreICUDefaultLocale over
16 // calling base::i18n::SetICUDefaultLocale() directly. This scoper makes it
17 // harder to accidentally forget to reset the locale.
18 class ScopedRestoreICUDefaultLocale {
19  public:
20   ScopedRestoreICUDefaultLocale();
21   explicit ScopedRestoreICUDefaultLocale(const std::string& locale);
22   ~ScopedRestoreICUDefaultLocale();
23 
24  private:
25   const std::string default_locale_;
26 
27   DISALLOW_COPY_AND_ASSIGN(ScopedRestoreICUDefaultLocale);
28 };
29 
30 void InitializeICUForTesting();
31 
32 }  // namespace test
33 }  // namespace base
34 
35 #endif  // BASE_TEST_ICU_TEST_UTIL_H_
36