diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-06 08:36:26 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-06 08:36:26 +0000 |
commit | 503d0387804c4ddf22a52857407e885ce737dbba (patch) | |
tree | b207cd83412330671e898e7c9063da60338be86f /base/i18n/case_conversion_unittest.cc | |
parent | cc7b9ccdc9f6eb94a89c0ce6f8e8af341eea4370 (diff) | |
download | chromium_src-503d0387804c4ddf22a52857407e885ce737dbba.zip chromium_src-503d0387804c4ddf22a52857407e885ce737dbba.tar.gz chromium_src-503d0387804c4ddf22a52857407e885ce737dbba.tar.bz2 |
FTP: split the directory listing parser test and re-enable it on TSan bots
The test was disabled on TSan bots becuase it was taking too much time.
This change converts one huge test which parses ~30 directory listings
to ~30 separate test cases.
This change also moves ToLower/ToUpper from ui/base/l10n_util
to base/i18n/case_conversion so that they can be used in net/ftp.
BUG=79022
Review URL: http://codereview.chromium.org/6905027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84413 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/i18n/case_conversion_unittest.cc')
-rw-r--r-- | base/i18n/case_conversion_unittest.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/base/i18n/case_conversion_unittest.cc b/base/i18n/case_conversion_unittest.cc new file mode 100644 index 0000000..87a349e --- /dev/null +++ b/base/i18n/case_conversion_unittest.cc @@ -0,0 +1,39 @@ +// 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 "base/i18n/case_conversion.h" +#include "base/utf_string_conversions.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +// Test upper and lower case string conversion. +TEST(CaseConversionTest, UpperLower) { + string16 mixed(ASCIIToUTF16("Text with UPPer & lowER casE.")); + const string16 expected_lower(ASCIIToUTF16("text with upper & lower case.")); + const string16 expected_upper(ASCIIToUTF16("TEXT WITH UPPER & LOWER CASE.")); + + string16 result = base::i18n::ToLower(mixed); + EXPECT_EQ(expected_lower, result); + + result = base::i18n::ToUpper(mixed); + EXPECT_EQ(expected_upper, result); +} + +// Test upper and lower case string conversion. +TEST(CaseConversionTest, WideUpperLower) { + std::wstring mixed(L"Text with UPPer & lowER casE."); + const std::wstring expected_lower(L"text with upper & lower case."); + const std::wstring expected_upper(L"TEXT WITH UPPER & LOWER CASE."); + + std::wstring result = base::i18n::WideToLower(mixed); + EXPECT_EQ(expected_lower, result); + + result = base::i18n::WideToUpper(mixed); + EXPECT_EQ(expected_upper, result); +} + +// TODO(jshin): More tests are needed, especially with non-ASCII characters. + +} // namespace |