summaryrefslogtreecommitdiffstats
path: root/base/file_util_unittest.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-24 03:29:26 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-24 03:29:26 +0000
commit172c55057003795131ecb2ad5dd012b0c1785171 (patch)
tree378dc00f1ad5af386876de3fc5d19e2da0b38ade /base/file_util_unittest.cc
parenteb0022ffdefb2fddcb251f5b77a8f9dbfe62d8b2 (diff)
downloadchromium_src-172c55057003795131ecb2ad5dd012b0c1785171.zip
chromium_src-172c55057003795131ecb2ad5dd012b0c1785171.tar.gz
chromium_src-172c55057003795131ecb2ad5dd012b0c1785171.tar.bz2
Order posix file listings by type as well as name.
http://crbug.com/12812 TEST=go to /, see that directories are sorted before other files. Review URL: http://codereview.chromium.org/147063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19100 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_unittest.cc')
-rw-r--r--base/file_util_unittest.cc21
1 files changed, 19 insertions, 2 deletions
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index 3ecd1cf..e0884f7 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -1035,10 +1035,12 @@ TEST_F(FileUtilTest, FileEnumeratorOrderTest) {
EXPECT_TRUE(file_util::CreateDirectory(dirC));
EXPECT_TRUE(file_util::CreateDirectory(dirD));
- // Files and directories are enumerated in the lexicographical order,
- // ignoring case and whether they are files or directories.
+ // 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());
@@ -1051,6 +1053,21 @@ TEST_F(FileUtilTest, FileEnumeratorOrderTest) {
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());
}