Index: base/test/scoped_locale.cc |
diff --git a/base/test/scoped_locale.cc b/base/test/scoped_locale.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..975aad53147deeeb854facde18a62065caee8ca2 |
--- /dev/null |
+++ b/base/test/scoped_locale.cc |
@@ -0,0 +1,20 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include <locale.h> |
+ |
+#include "base/test/scoped_locale.h" |
Paweł Hajdan Jr.
2011/06/10 17:00:51
nit: This must always be the first header.
Joao da Silva
2011/06/14 16:48:44
Done.
|
+ |
+namespace base { |
+ |
+ScopedSetLocale::ScopedSetLocale(const std::string& locale) { |
+ prev_locale_ = setlocale(LC_ALL, NULL); |
+ current_locale_ = setlocale(LC_ALL, locale.c_str()); |
Joao da Silva
2011/06/10 15:53:56
We can't do much in the ctor about it, so I've add
Paweł Hajdan Jr.
2011/06/10 17:00:51
I'd prefer using gtest's EXPECT_ macro and getting
Joao da Silva
2011/06/14 16:48:44
I tried that (see patch set 4), and it worked fine
Paweł Hajdan Jr.
2011/06/14 20:20:07
Can we get the locale installed on the bots? The p
Joao da Silva
2011/06/15 10:15:13
I'll try to get the locale on the linux bots.
Not
Paweł Hajdan Jr.
2011/06/16 10:33:27
Thanks, I've noticed the bug - sounds good.
Joao da Silva
2011/06/16 11:12:18
It's not clear to me what you mean here. Did you m
Paweł Hajdan Jr.
2011/06/16 11:46:19
Sorry, I think I meant
3. actually use EXPECT_TRU
|
+} |
+ |
+ScopedSetLocale::~ScopedSetLocale() { |
+ setlocale(LC_ALL, prev_locale_); |
+} |
+ |
+} // namespace base |