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

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: Rebase again... Created 9 years, 6 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.
Paweł Hajdan Jr. 2011/06/09 08:43:22 Please don't add yet another _util file. How about
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) {
Paweł Hajdan Jr. 2011/06/09 08:43:22 nit: Could you change the type of the parameter to
24 old_locale_ = setlocale(LC_ALL, NULL);
25 setlocale(LC_ALL, locale);
Paweł Hajdan Jr. 2011/06/09 08:43:22 Please check the return value. NULL would indicate
26 }
Paweł Hajdan Jr. 2011/06/09 08:43:22 nit: Add empty line below.
27 ~ScopedSetLocale() {
28 setlocale(LC_ALL, old_locale_.c_str());
29 }
30
31 private:
32 std::string old_locale_;
33
34 DISALLOW_COPY_AND_ASSIGN(ScopedSetLocale);
35 };
36
37 #endif
38
39 } // namespace base
40
41 #endif // BASE_TEST_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698