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 /ui/base/l10n | |
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 'ui/base/l10n')
-rw-r--r-- | ui/base/l10n/l10n_util.cc | 20 | ||||
-rw-r--r-- | ui/base/l10n/l10n_util.h | 6 | ||||
-rw-r--r-- | ui/base/l10n/l10n_util_unittest.cc | 18 |
3 files changed, 3 insertions, 41 deletions
diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc index 139e8f1..e39cfbe 100644 --- a/ui/base/l10n/l10n_util.cc +++ b/ui/base/l10n/l10n_util.cc @@ -779,26 +779,6 @@ string16 TruncateString(const string16& string, size_t length) { return string.substr(0, index) + kElideString; } -string16 ToLower(const string16& string) { - icu::UnicodeString lower_u_str( - icu::UnicodeString(FALSE, string.c_str(), string.size()).toLower( - icu::Locale::getDefault())); - string16 result; - lower_u_str.extract(0, lower_u_str.length(), - WriteInto(&result, lower_u_str.length() + 1)); - return result; -} - -string16 ToUpper(const string16& string) { - icu::UnicodeString upper_u_str( - icu::UnicodeString(FALSE, string.c_str(), string.size()).toUpper( - icu::Locale::getDefault())); - string16 result; - upper_u_str.extract(0, upper_u_str.length(), - WriteInto(&result, upper_u_str.length() + 1)); - return result; -} - // Compares the character data stored in two different string16 strings by // specified Collator instance. UCollationResult CompareString16WithCollator(const icu::Collator* collator, diff --git a/ui/base/l10n/l10n_util.h b/ui/base/l10n/l10n_util.h index d0418c0..1478ae2 100644 --- a/ui/base/l10n/l10n_util.h +++ b/ui/base/l10n/l10n_util.h @@ -131,12 +131,6 @@ string16 GetStringFUTF16Int(int message_id, int64 a); // less. string16 TruncateString(const string16& string, size_t length); -// Returns the lower case equivalent of string. -string16 ToLower(const string16& string); - -// Returns the upper case equivalent of string. -string16 ToUpper(const string16& string); - // In place sorting of string16 strings using collation rules for |locale|. void SortStrings16(const std::string& locale, std::vector<string16>* strings); diff --git a/ui/base/l10n/l10n_util_unittest.cc b/ui/base/l10n/l10n_util_unittest.cc index 90aaeff..8b24181 100644 --- a/ui/base/l10n/l10n_util_unittest.cc +++ b/ui/base/l10n/l10n_util_unittest.cc @@ -11,6 +11,7 @@ #include "base/basictypes.h" #include "base/environment.h" #include "base/file_util.h" +#include "base/i18n/case_conversion.h" #include "base/path_service.h" #include "base/stl_util-inl.h" #include "base/string_util.h" @@ -303,19 +304,6 @@ TEST_F(L10nUtilTest, SortStringsUsingFunction) { STLDeleteElements(&strings); } -// Test upper and lower case string conversion. -TEST_F(L10nUtilTest, 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 = l10n_util::ToLower(mixed); - EXPECT_EQ(expected_lower, result); - - result = l10n_util::ToUpper(mixed); - EXPECT_EQ(expected_upper, result); -} - TEST_F(L10nUtilTest, LocaleDisplayName) { // TODO(jungshik): Make this test more extensive. // Test zh-CN and zh-TW are treated as zh-Hans and zh-Hant. @@ -336,12 +324,12 @@ TEST_F(L10nUtilTest, LocaleDisplayName) { char16 buf_with_null[length_with_null] = { 0, 'a', 0, 'b' }; string16 string16_with_null(buf_with_null, length_with_null); - string16 upper_with_null = l10n_util::ToUpper(string16_with_null); + string16 upper_with_null = base::i18n::ToUpper(string16_with_null); ASSERT_EQ(length_with_null, upper_with_null.size()); EXPECT_TRUE(upper_with_null[0] == 0 && upper_with_null[1] == 'A' && upper_with_null[2] == 0 && upper_with_null[3] == 'B'); - string16 lower_with_null = l10n_util::ToLower(upper_with_null); + string16 lower_with_null = base::i18n::ToLower(upper_with_null); ASSERT_EQ(length_with_null, upper_with_null.size()); EXPECT_TRUE(lower_with_null[0] == 0 && lower_with_null[1] == 'a' && lower_with_null[2] == 0 && lower_with_null[3] == 'b'); |