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

Unified Diff: base/sys_string_conversions_unittest.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base.gyp ('k') | base/test/test_util.h » ('j') | base/test/test_util.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sys_string_conversions_unittest.cc
diff --git a/base/sys_string_conversions_unittest.cc b/base/sys_string_conversions_unittest.cc
index 708da09411283d0ba9d25dd4587936bb0b98d3b6..fa711f38d2eca69ae3129ae61f0e5e19b9862992 100644
--- a/base/sys_string_conversions_unittest.cc
+++ b/base/sys_string_conversions_unittest.cc
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <locale.h>
#include <string>
#include "base/basictypes.h"
#include "base/string_piece.h"
+#include "base/test/test_util.h"
#include "base/utf_string_conversions.h"
#include "base/sys_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -74,27 +74,10 @@ TEST(SysStrings, SysUTF8ToWide) {
}
#if defined(OS_LINUX) // Tests depend on setting a specific Linux locale.
-namespace {
-
-class ScopedSetLocale {
- public:
- explicit ScopedSetLocale(const char* locale) {
- old_locale_ = setlocale(LC_ALL, NULL);
- setlocale(LC_ALL, locale);
- }
- ~ScopedSetLocale() {
- setlocale(LC_ALL, old_locale_.c_str());
- }
-
- private:
- std::string old_locale_;
-};
-
-} // namespace
TEST(SysStrings, SysWideToNativeMB) {
using base::SysWideToNativeMB;
- ScopedSetLocale locale("en_US.utf-8");
+ base::ScopedSetLocale locale("en_US.utf-8");
EXPECT_EQ("Hello, world", SysWideToNativeMB(L"Hello, world"));
EXPECT_EQ("\xe4\xbd\xa0\xe5\xa5\xbd", SysWideToNativeMB(L"\x4f60\x597d"));
@@ -125,7 +108,7 @@ TEST(SysStrings, SysWideToNativeMB) {
// We assume the test is running in a UTF8 locale.
TEST(SysStrings, SysNativeMBToWide) {
using base::SysNativeMBToWide;
- ScopedSetLocale locale("en_US.utf-8");
+ base::ScopedSetLocale locale("en_US.utf-8");
EXPECT_EQ(L"Hello, world", SysNativeMBToWide("Hello, world"));
EXPECT_EQ(L"\x4f60\x597d", SysNativeMBToWide("\xe4\xbd\xa0\xe5\xa5\xbd"));
// >16 bits
@@ -179,7 +162,7 @@ static const wchar_t* const kConvertRoundtripCases[] = {
TEST(SysStrings, SysNativeMBAndWide) {
- ScopedSetLocale locale("en_US.utf-8");
+ base::ScopedSetLocale locale("en_US.utf-8");
for (size_t i = 0; i < arraysize(kConvertRoundtripCases); ++i) {
std::wstring wide = kConvertRoundtripCases[i];
std::wstring trip = base::SysNativeMBToWide(base::SysWideToNativeMB(wide));
« no previous file with comments | « base/base.gyp ('k') | base/test/test_util.h » ('j') | base/test/test_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698