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

Side by Side Diff: base/test/test_util.h

Issue 7003028: Added a test checking for TimeFormat:: producing NaN, rolled icu version (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved to a dedicated browser_test. Created 9 years, 7 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
(Empty)
1 // Copyright (c) 2011 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_TEST_UTIL_H_
6 #define BASE_TEST_TEST_UTIL_H_
7 #pragma once
8
9 // Generic utilities used only by tests.
10
11 #include <locale.h>
12
13 #include <string>
14
15 namespace base {
16
17 #if defined(OS_POSIX)
18
19 // Sets the given |locale| on construction, and restores the previous locale
20 // on destruction.
21 class ScopedSetLocale {
22 public:
23 explicit ScopedSetLocale(const char* locale) {
24 old_locale_ = setlocale(LC_ALL, NULL);
25 setlocale(LC_ALL, locale);
26 }
27 ~ScopedSetLocale() {
28 setlocale(LC_ALL, old_locale_.c_str());
29 }
30
31 private:
32 std::string old_locale_;
33 };
34
35 #endif
36
37 } // namespace base
38
39 #endif // BASE_TEST_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698