Separate out some more ICU from base and into base/i18n.

This moves string_util_icu. I moved the number formatting function into
base/i18n/number_formatting and just removed the other function in
string_util_icu which was TrimWhitespaceUTF8. It is only used in a few places
and isn't actually helpful (and the fact that it round-trips through UTF-16 is
better for the caller to see).

This takes out the sorting from the FileEnumerator. The comment says the
sorting is not guaranteed. I moved it into file_util_icu as a standalone
function for callers of FileEnumerator to call manually if they need sorted
results. I modified the directory lister to use this sorting instead, and filed
a bug on doing more optimal JS-based sorting.

TEST=none
BUG=none
Review URL: http://codereview.chromium.org/267001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28405 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: d0767cb54b2b5ee4d9cf00b3ee0fa585826b4036
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index 5b606c9..b1f9fed 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 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.
 
@@ -876,41 +876,6 @@
   EXPECT_TRUE(file_util::Delete(test_root, true));
 }
 
-static const struct goodbad_pair {
-  std::wstring bad_name;
-  std::wstring good_name;
-} kIllegalCharacterCases[] = {
-  {L"bad*file:name?.jpg", L"bad-file-name-.jpg"},
-  {L"**********::::.txt", L"--------------.txt"},
-  // We can't use UCNs (universal character names) for C0/C1 characters and
-  // U+007F, but \x escape is interpreted by MSVC and gcc as we intend.
-  {L"bad\x0003\x0091 file\u200E\u200Fname.png", L"bad-- file--name.png"},
-#if defined(OS_WIN)
-  {L"bad*file\\name.jpg", L"bad-file-name.jpg"},
-  {L"\t  bad*file\\name/.jpg ", L"bad-file-name-.jpg"},
-#elif defined(OS_POSIX)
-  {L"bad*file?name.jpg", L"bad-file-name.jpg"},
-  {L"\t  bad*file?name/.jpg ", L"bad-file-name-.jpg"},
-#endif
-  {L"this_file_name is okay!.mp3", L"this_file_name is okay!.mp3"},
-  {L"\u4E00\uAC00.mp3", L"\u4E00\uAC00.mp3"},
-  {L"\u0635\u200C\u0644.mp3", L"\u0635\u200C\u0644.mp3"},
-  {L"\U00010330\U00010331.mp3", L"\U00010330\U00010331.mp3"},
-  // Unassigned codepoints are ok.
-  {L"\u0378\U00040001.mp3", L"\u0378\U00040001.mp3"},
-  // Non-characters are not allowed.
-  {L"bad\uFFFFfile\U0010FFFEname.jpg ", L"bad-file-name.jpg"},
-  {L"bad\uFDD0file\uFDEFname.jpg ", L"bad-file-name.jpg"},
-};
-
-TEST_F(FileUtilTest, ReplaceIllegalCharactersTest) {
-  for (unsigned int i = 0; i < arraysize(kIllegalCharacterCases); ++i) {
-    std::wstring bad_name(kIllegalCharacterCases[i].bad_name);
-    file_util::ReplaceIllegalCharacters(&bad_name, L'-');
-    EXPECT_EQ(kIllegalCharacterCases[i].good_name, bad_name);
-  }
-}
-
 static const struct ReplaceExtensionCase {
   std::wstring file_name;
   FilePath::StringType extension;
@@ -1069,58 +1034,6 @@
                                             // (we don't care what).
 }
 
-TEST_F(FileUtilTest, FileEnumeratorOrderTest) {
-  FilePath fileA = test_dir_.Append(FILE_PATH_LITERAL("a"));
-  FilePath fileB = test_dir_.Append(FILE_PATH_LITERAL("B"));
-  FilePath dirC = test_dir_.Append(FILE_PATH_LITERAL("C"));
-  FilePath dirD = test_dir_.Append(FILE_PATH_LITERAL("d"));
-  FilePath dirE = test_dir_.Append(FILE_PATH_LITERAL("e"));
-  FilePath fileF = test_dir_.Append(FILE_PATH_LITERAL("f"));
-
-  // Create files/directories in near random order.
-  CreateTextFile(fileF, L"");
-  CreateTextFile(fileA, L"");
-  CreateTextFile(fileB, L"");
-  EXPECT_TRUE(file_util::CreateDirectory(dirE));
-  EXPECT_TRUE(file_util::CreateDirectory(dirC));
-  EXPECT_TRUE(file_util::CreateDirectory(dirD));
-
-  // On Windows, files and directories are enumerated in the lexicographical
-  // order, ignoring case and whether they are files or directories. On posix,
-  // we order directories before files.
-  file_util::FileEnumerator enumerator(test_dir_, false, FILES_AND_DIRECTORIES);
-  FilePath cur_file = enumerator.Next();
-#if defined(OS_WIN)
-  EXPECT_EQ(fileA.value(), cur_file.value());
-  cur_file = enumerator.Next();
-  EXPECT_EQ(fileB.value(), cur_file.value());
-  cur_file = enumerator.Next();
-  EXPECT_EQ(dirC.value(), cur_file.value());
-  cur_file = enumerator.Next();
-  EXPECT_EQ(dirD.value(), cur_file.value());
-  cur_file = enumerator.Next();
-  EXPECT_EQ(dirE.value(), cur_file.value());
-  cur_file = enumerator.Next();
-  EXPECT_EQ(fileF.value(), cur_file.value());
-  cur_file = enumerator.Next();
-#elif defined(OS_POSIX)
-  EXPECT_EQ(dirC.value(), cur_file.value());
-  cur_file = enumerator.Next();
-  EXPECT_EQ(dirD.value(), cur_file.value());
-  cur_file = enumerator.Next();
-  EXPECT_EQ(dirE.value(), cur_file.value());
-  cur_file = enumerator.Next();
-  EXPECT_EQ(fileA.value(), cur_file.value());
-  cur_file = enumerator.Next();
-  EXPECT_EQ(fileB.value(), cur_file.value());
-  cur_file = enumerator.Next();
-  EXPECT_EQ(fileF.value(), cur_file.value());
-  cur_file = enumerator.Next();
-#endif
-
-  EXPECT_EQ(FILE_PATH_LITERAL(""), cur_file.value());
-}
-
 TEST_F(FileUtilTest, Contains) {
   FilePath data_dir = test_dir_.Append(FILE_PATH_LITERAL("FilePathTest"));