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

Unified Diff: base/file_util_unittest.cc

Issue 147063: Order posix file listings by type as well as name.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: pass unit tests Created 11 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/file_util_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_unittest.cc
===================================================================
--- base/file_util_unittest.cc (revision 19057)
+++ base/file_util_unittest.cc (working copy)
@@ -1035,10 +1035,12 @@
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 @@
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());
}
« no previous file with comments | « base/file_util_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698