OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 | 878 |
879 // Only enumerate directories. | 879 // Only enumerate directories. |
880 file_util::FileEnumerator f2(test_dir_, true, | 880 file_util::FileEnumerator f2(test_dir_, true, |
881 file_util::FileEnumerator::DIRECTORIES); | 881 file_util::FileEnumerator::DIRECTORIES); |
882 FindResultCollector c2(f2); | 882 FindResultCollector c2(f2); |
883 EXPECT_TRUE(c2.HasFile(dir1)); | 883 EXPECT_TRUE(c2.HasFile(dir1)); |
884 EXPECT_TRUE(c2.HasFile(dir2)); | 884 EXPECT_TRUE(c2.HasFile(dir2)); |
885 EXPECT_TRUE(c2.HasFile(dir2inner)); | 885 EXPECT_TRUE(c2.HasFile(dir2inner)); |
886 EXPECT_EQ(c2.size(), 3); | 886 EXPECT_EQ(c2.size(), 3); |
887 | 887 |
| 888 // Only enumerate directories non-recursively. |
| 889 file_util::FileEnumerator f2_non_recursive( |
| 890 test_dir_, false, file_util::FileEnumerator::DIRECTORIES); |
| 891 FindResultCollector c2_non_recursive(f2_non_recursive); |
| 892 EXPECT_TRUE(c2_non_recursive.HasFile(dir1)); |
| 893 EXPECT_TRUE(c2_non_recursive.HasFile(dir2)); |
| 894 EXPECT_EQ(c2_non_recursive.size(), 2); |
| 895 |
888 // Enumerate files and directories. | 896 // Enumerate files and directories. |
889 file_util::FileEnumerator f3(test_dir_, true, | 897 file_util::FileEnumerator f3(test_dir_, true, |
890 file_util::FileEnumerator::FILES_AND_DIRECTORIES); | 898 file_util::FileEnumerator::FILES_AND_DIRECTORIES); |
891 FindResultCollector c3(f3); | 899 FindResultCollector c3(f3); |
892 EXPECT_TRUE(c3.HasFile(dir1)); | 900 EXPECT_TRUE(c3.HasFile(dir1)); |
893 EXPECT_TRUE(c3.HasFile(dir2)); | 901 EXPECT_TRUE(c3.HasFile(dir2)); |
894 EXPECT_TRUE(c3.HasFile(file1)); | 902 EXPECT_TRUE(c3.HasFile(file1)); |
895 EXPECT_TRUE(c3.HasFile(file2_abs)); | 903 EXPECT_TRUE(c3.HasFile(file2_abs)); |
896 EXPECT_TRUE(c3.HasFile(dir2file)); | 904 EXPECT_TRUE(c3.HasFile(dir2file)); |
897 EXPECT_TRUE(c3.HasFile(dir2inner)); | 905 EXPECT_TRUE(c3.HasFile(dir2inner)); |
(...skipping 23 matching lines...) Expand all Loading... |
921 | 929 |
922 // Make sure the destructor closes the find handle while in the middle of a | 930 // Make sure the destructor closes the find handle while in the middle of a |
923 // query to allow TearDown to delete the directory. | 931 // query to allow TearDown to delete the directory. |
924 file_util::FileEnumerator f6(test_dir_, true, | 932 file_util::FileEnumerator f6(test_dir_, true, |
925 file_util::FileEnumerator::FILES_AND_DIRECTORIES); | 933 file_util::FileEnumerator::FILES_AND_DIRECTORIES); |
926 EXPECT_FALSE(f6.Next().empty()); // Should have found something | 934 EXPECT_FALSE(f6.Next().empty()); // Should have found something |
927 // (we don't care what). | 935 // (we don't care what). |
928 } | 936 } |
929 | 937 |
930 } // namespace | 938 } // namespace |
OLD | NEW |