OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
31 #include "base/win/scoped_handle.h" | 31 #include "base/win/scoped_handle.h" |
32 #endif | 32 #endif |
33 | 33 |
34 // This macro helps avoid wrapped lines in the test structs. | 34 // This macro helps avoid wrapped lines in the test structs. |
35 #define FPL(x) FILE_PATH_LITERAL(x) | 35 #define FPL(x) FILE_PATH_LITERAL(x) |
36 | 36 |
37 using base::FilePath; | 37 using base::FilePath; |
38 | 38 |
39 namespace { | 39 namespace file_util { |
40 | 40 |
41 // To test that file_util::Normalize FilePath() deals with NTFS reparse points | 41 // To test that file_util::Normalize FilePath() deals with NTFS reparse points |
42 // correctly, we need functions to create and delete reparse points. | 42 // correctly, we need functions to create and delete reparse points. |
43 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
44 typedef struct _REPARSE_DATA_BUFFER { | 44 typedef struct _REPARSE_DATA_BUFFER { |
45 ULONG ReparseTag; | 45 ULONG ReparseTag; |
46 USHORT ReparseDataLength; | 46 USHORT ReparseDataLength; |
47 USHORT Reserved; | 47 USHORT Reserved; |
48 union { | 48 union { |
49 struct { | 49 struct { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 int mode = 0; | 126 int mode = 0; |
127 ASSERT_TRUE(file_util::GetPosixFilePermissions(path, &mode)); | 127 ASSERT_TRUE(file_util::GetPosixFilePermissions(path, &mode)); |
128 mode |= mode_bits_to_set; | 128 mode |= mode_bits_to_set; |
129 mode &= ~mode_bits_to_clear; | 129 mode &= ~mode_bits_to_clear; |
130 ASSERT_TRUE(file_util::SetPosixFilePermissions(path, mode)); | 130 ASSERT_TRUE(file_util::SetPosixFilePermissions(path, mode)); |
131 } | 131 } |
132 #endif // defined(OS_POSIX) | 132 #endif // defined(OS_POSIX) |
133 | 133 |
134 const wchar_t bogus_content[] = L"I'm cannon fodder."; | 134 const wchar_t bogus_content[] = L"I'm cannon fodder."; |
135 | 135 |
136 const int FILES_AND_DIRECTORIES = | 136 const int FILES_AND_DIRECTORIES = FileEnumerator::FILES | |
137 file_util::FileEnumerator::FILES | file_util::FileEnumerator::DIRECTORIES; | 137 FileEnumerator::DIRECTORIES; |
138 | 138 |
139 // file_util winds up using autoreleased objects on the Mac, so this needs | 139 // file_util winds up using autoreleased objects on the Mac, so this needs |
140 // to be a PlatformTest | 140 // to be a PlatformTest |
141 class FileUtilTest : public PlatformTest { | 141 class FileUtilTest : public PlatformTest { |
142 protected: | 142 protected: |
143 virtual void SetUp() OVERRIDE { | 143 virtual void SetUp() OVERRIDE { |
144 PlatformTest::SetUp(); | 144 PlatformTest::SetUp(); |
145 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 145 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
146 } | 146 } |
147 | 147 |
148 base::ScopedTempDir temp_dir_; | 148 base::ScopedTempDir temp_dir_; |
149 }; | 149 }; |
150 | 150 |
151 // Collects all the results from the given file enumerator, and provides an | 151 // Collects all the results from the given file enumerator, and provides an |
152 // interface to query whether a given file is present. | 152 // interface to query whether a given file is present. |
153 class FindResultCollector { | 153 class FindResultCollector { |
154 public: | 154 public: |
155 explicit FindResultCollector(file_util::FileEnumerator& enumerator) { | 155 explicit FindResultCollector(FileEnumerator& enumerator) { |
156 FilePath cur_file; | 156 FilePath cur_file; |
157 while (!(cur_file = enumerator.Next()).value().empty()) { | 157 while (!(cur_file = enumerator.Next()).value().empty()) { |
158 FilePath::StringType path = cur_file.value(); | 158 FilePath::StringType path = cur_file.value(); |
159 // The file should not be returned twice. | 159 // The file should not be returned twice. |
160 EXPECT_TRUE(files_.end() == files_.find(path)) | 160 EXPECT_TRUE(files_.end() == files_.find(path)) |
161 << "Same file returned twice"; | 161 << "Same file returned twice"; |
162 | 162 |
163 // Save for later. | 163 // Save for later. |
164 files_.insert(path); | 164 files_.insert(path); |
165 } | 165 } |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 EXPECT_TRUE(file_util::GetPosixFilePermissions(subdir_path, &mode)); | 939 EXPECT_TRUE(file_util::GetPosixFilePermissions(subdir_path, &mode)); |
940 EXPECT_EQ(file_util::FILE_PERMISSION_USER_MASK, | 940 EXPECT_EQ(file_util::FILE_PERMISSION_USER_MASK, |
941 mode & file_util::FILE_PERMISSION_USER_MASK); | 941 mode & file_util::FILE_PERMISSION_USER_MASK); |
942 | 942 |
943 // Get rid of the permissions from the directory. | 943 // Get rid of the permissions from the directory. |
944 EXPECT_TRUE(file_util::SetPosixFilePermissions(subdir_path, 0u)); | 944 EXPECT_TRUE(file_util::SetPosixFilePermissions(subdir_path, 0u)); |
945 EXPECT_TRUE(file_util::GetPosixFilePermissions(subdir_path, &mode)); | 945 EXPECT_TRUE(file_util::GetPosixFilePermissions(subdir_path, &mode)); |
946 EXPECT_FALSE(mode & file_util::FILE_PERMISSION_USER_MASK); | 946 EXPECT_FALSE(mode & file_util::FILE_PERMISSION_USER_MASK); |
947 | 947 |
948 // Make sure the file in the directory can't be enumerated. | 948 // Make sure the file in the directory can't be enumerated. |
949 file_util::FileEnumerator f1(subdir_path, true, | 949 FileEnumerator f1(subdir_path, true, FileEnumerator::FILES); |
950 file_util::FileEnumerator::FILES); | |
951 EXPECT_TRUE(file_util::PathExists(subdir_path)); | 950 EXPECT_TRUE(file_util::PathExists(subdir_path)); |
952 FindResultCollector c1(f1); | 951 FindResultCollector c1(f1); |
953 EXPECT_EQ(c1.size(), 0); | 952 EXPECT_EQ(c1.size(), 0); |
954 EXPECT_FALSE(file_util::GetPosixFilePermissions(file_name, &mode)); | 953 EXPECT_FALSE(file_util::GetPosixFilePermissions(file_name, &mode)); |
955 | 954 |
956 // Give the permissions to the directory. | 955 // Give the permissions to the directory. |
957 EXPECT_TRUE(file_util::SetPosixFilePermissions( | 956 EXPECT_TRUE(file_util::SetPosixFilePermissions( |
958 subdir_path, | 957 subdir_path, |
959 file_util::FILE_PERMISSION_USER_MASK)); | 958 file_util::FILE_PERMISSION_USER_MASK)); |
960 EXPECT_TRUE(file_util::GetPosixFilePermissions(subdir_path, &mode)); | 959 EXPECT_TRUE(file_util::GetPosixFilePermissions(subdir_path, &mode)); |
961 EXPECT_EQ(file_util::FILE_PERMISSION_USER_MASK, | 960 EXPECT_EQ(file_util::FILE_PERMISSION_USER_MASK, |
962 mode & file_util::FILE_PERMISSION_USER_MASK); | 961 mode & file_util::FILE_PERMISSION_USER_MASK); |
963 | 962 |
964 // Make sure the file in the directory can be enumerated. | 963 // Make sure the file in the directory can be enumerated. |
965 file_util::FileEnumerator f2(subdir_path, true, | 964 FileEnumerator f2(subdir_path, true, FileEnumerator::FILES); |
966 file_util::FileEnumerator::FILES); | |
967 FindResultCollector c2(f2); | 965 FindResultCollector c2(f2); |
968 EXPECT_TRUE(c2.HasFile(file_name)); | 966 EXPECT_TRUE(c2.HasFile(file_name)); |
969 EXPECT_EQ(c2.size(), 1); | 967 EXPECT_EQ(c2.size(), 1); |
970 | 968 |
971 // Delete the file. | 969 // Delete the file. |
972 EXPECT_TRUE(file_util::Delete(subdir_path, true)); | 970 EXPECT_TRUE(file_util::Delete(subdir_path, true)); |
973 EXPECT_FALSE(file_util::PathExists(subdir_path)); | 971 EXPECT_FALSE(file_util::PathExists(subdir_path)); |
974 } | 972 } |
975 | 973 |
976 #endif // defined(OS_POSIX) | 974 #endif // defined(OS_POSIX) |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 CreateTextFile(test_path, L"test file"); | 1848 CreateTextFile(test_path, L"test file"); |
1851 EXPECT_TRUE(file_util::PathExists(test_path)); | 1849 EXPECT_TRUE(file_util::PathExists(test_path)); |
1852 EXPECT_FALSE(file_util::DirectoryExists(test_path)); | 1850 EXPECT_FALSE(file_util::DirectoryExists(test_path)); |
1853 EXPECT_TRUE(file_util::Delete(test_path, false)); | 1851 EXPECT_TRUE(file_util::Delete(test_path, false)); |
1854 | 1852 |
1855 EXPECT_TRUE(file_util::Delete(test_root, true)); | 1853 EXPECT_TRUE(file_util::Delete(test_root, true)); |
1856 } | 1854 } |
1857 | 1855 |
1858 TEST_F(FileUtilTest, FileEnumeratorTest) { | 1856 TEST_F(FileUtilTest, FileEnumeratorTest) { |
1859 // Test an empty directory. | 1857 // Test an empty directory. |
1860 file_util::FileEnumerator f0(temp_dir_.path(), true, FILES_AND_DIRECTORIES); | 1858 FileEnumerator f0(temp_dir_.path(), true, FILES_AND_DIRECTORIES); |
1861 EXPECT_EQ(f0.Next().value(), FILE_PATH_LITERAL("")); | 1859 EXPECT_EQ(f0.Next().value(), FILE_PATH_LITERAL("")); |
1862 EXPECT_EQ(f0.Next().value(), FILE_PATH_LITERAL("")); | 1860 EXPECT_EQ(f0.Next().value(), FILE_PATH_LITERAL("")); |
1863 | 1861 |
1864 // Test an empty directory, non-recursively, including "..". | 1862 // Test an empty directory, non-recursively, including "..". |
1865 file_util::FileEnumerator f0_dotdot(temp_dir_.path(), false, | 1863 FileEnumerator f0_dotdot(temp_dir_.path(), false, |
1866 FILES_AND_DIRECTORIES | file_util::FileEnumerator::INCLUDE_DOT_DOT); | 1864 FILES_AND_DIRECTORIES | FileEnumerator::INCLUDE_DOT_DOT); |
1867 EXPECT_EQ(temp_dir_.path().Append(FILE_PATH_LITERAL("..")).value(), | 1865 EXPECT_EQ(temp_dir_.path().Append(FILE_PATH_LITERAL("..")).value(), |
1868 f0_dotdot.Next().value()); | 1866 f0_dotdot.Next().value()); |
1869 EXPECT_EQ(FILE_PATH_LITERAL(""), | 1867 EXPECT_EQ(FILE_PATH_LITERAL(""), |
1870 f0_dotdot.Next().value()); | 1868 f0_dotdot.Next().value()); |
1871 | 1869 |
1872 // create the directories | 1870 // create the directories |
1873 FilePath dir1 = temp_dir_.path().Append(FILE_PATH_LITERAL("dir1")); | 1871 FilePath dir1 = temp_dir_.path().Append(FILE_PATH_LITERAL("dir1")); |
1874 EXPECT_TRUE(file_util::CreateDirectory(dir1)); | 1872 EXPECT_TRUE(file_util::CreateDirectory(dir1)); |
1875 FilePath dir2 = temp_dir_.path().Append(FILE_PATH_LITERAL("dir2")); | 1873 FilePath dir2 = temp_dir_.path().Append(FILE_PATH_LITERAL("dir2")); |
1876 EXPECT_TRUE(file_util::CreateDirectory(dir2)); | 1874 EXPECT_TRUE(file_util::CreateDirectory(dir2)); |
1877 FilePath dir2inner = dir2.Append(FILE_PATH_LITERAL("inner")); | 1875 FilePath dir2inner = dir2.Append(FILE_PATH_LITERAL("inner")); |
1878 EXPECT_TRUE(file_util::CreateDirectory(dir2inner)); | 1876 EXPECT_TRUE(file_util::CreateDirectory(dir2inner)); |
1879 | 1877 |
1880 // create the files | 1878 // create the files |
1881 FilePath dir2file = dir2.Append(FILE_PATH_LITERAL("dir2file.txt")); | 1879 FilePath dir2file = dir2.Append(FILE_PATH_LITERAL("dir2file.txt")); |
1882 CreateTextFile(dir2file, L""); | 1880 CreateTextFile(dir2file, L""); |
1883 FilePath dir2innerfile = dir2inner.Append(FILE_PATH_LITERAL("innerfile.txt")); | 1881 FilePath dir2innerfile = dir2inner.Append(FILE_PATH_LITERAL("innerfile.txt")); |
1884 CreateTextFile(dir2innerfile, L""); | 1882 CreateTextFile(dir2innerfile, L""); |
1885 FilePath file1 = temp_dir_.path().Append(FILE_PATH_LITERAL("file1.txt")); | 1883 FilePath file1 = temp_dir_.path().Append(FILE_PATH_LITERAL("file1.txt")); |
1886 CreateTextFile(file1, L""); | 1884 CreateTextFile(file1, L""); |
1887 FilePath file2_rel = | 1885 FilePath file2_rel = |
1888 dir2.Append(FilePath::kParentDirectory) | 1886 dir2.Append(FilePath::kParentDirectory) |
1889 .Append(FILE_PATH_LITERAL("file2.txt")); | 1887 .Append(FILE_PATH_LITERAL("file2.txt")); |
1890 CreateTextFile(file2_rel, L""); | 1888 CreateTextFile(file2_rel, L""); |
1891 FilePath file2_abs = temp_dir_.path().Append(FILE_PATH_LITERAL("file2.txt")); | 1889 FilePath file2_abs = temp_dir_.path().Append(FILE_PATH_LITERAL("file2.txt")); |
1892 | 1890 |
1893 // Only enumerate files. | 1891 // Only enumerate files. |
1894 file_util::FileEnumerator f1(temp_dir_.path(), true, | 1892 FileEnumerator f1(temp_dir_.path(), true, FileEnumerator::FILES); |
1895 file_util::FileEnumerator::FILES); | |
1896 FindResultCollector c1(f1); | 1893 FindResultCollector c1(f1); |
1897 EXPECT_TRUE(c1.HasFile(file1)); | 1894 EXPECT_TRUE(c1.HasFile(file1)); |
1898 EXPECT_TRUE(c1.HasFile(file2_abs)); | 1895 EXPECT_TRUE(c1.HasFile(file2_abs)); |
1899 EXPECT_TRUE(c1.HasFile(dir2file)); | 1896 EXPECT_TRUE(c1.HasFile(dir2file)); |
1900 EXPECT_TRUE(c1.HasFile(dir2innerfile)); | 1897 EXPECT_TRUE(c1.HasFile(dir2innerfile)); |
1901 EXPECT_EQ(c1.size(), 4); | 1898 EXPECT_EQ(c1.size(), 4); |
1902 | 1899 |
1903 // Only enumerate directories. | 1900 // Only enumerate directories. |
1904 file_util::FileEnumerator f2(temp_dir_.path(), true, | 1901 FileEnumerator f2(temp_dir_.path(), true, FileEnumerator::DIRECTORIES); |
1905 file_util::FileEnumerator::DIRECTORIES); | |
1906 FindResultCollector c2(f2); | 1902 FindResultCollector c2(f2); |
1907 EXPECT_TRUE(c2.HasFile(dir1)); | 1903 EXPECT_TRUE(c2.HasFile(dir1)); |
1908 EXPECT_TRUE(c2.HasFile(dir2)); | 1904 EXPECT_TRUE(c2.HasFile(dir2)); |
1909 EXPECT_TRUE(c2.HasFile(dir2inner)); | 1905 EXPECT_TRUE(c2.HasFile(dir2inner)); |
1910 EXPECT_EQ(c2.size(), 3); | 1906 EXPECT_EQ(c2.size(), 3); |
1911 | 1907 |
1912 // Only enumerate directories non-recursively. | 1908 // Only enumerate directories non-recursively. |
1913 file_util::FileEnumerator f2_non_recursive( | 1909 FileEnumerator f2_non_recursive(temp_dir_.path(), false, |
1914 temp_dir_.path(), false, file_util::FileEnumerator::DIRECTORIES); | 1910 FileEnumerator::DIRECTORIES); |
1915 FindResultCollector c2_non_recursive(f2_non_recursive); | 1911 FindResultCollector c2_non_recursive(f2_non_recursive); |
1916 EXPECT_TRUE(c2_non_recursive.HasFile(dir1)); | 1912 EXPECT_TRUE(c2_non_recursive.HasFile(dir1)); |
1917 EXPECT_TRUE(c2_non_recursive.HasFile(dir2)); | 1913 EXPECT_TRUE(c2_non_recursive.HasFile(dir2)); |
1918 EXPECT_EQ(c2_non_recursive.size(), 2); | 1914 EXPECT_EQ(c2_non_recursive.size(), 2); |
1919 | 1915 |
1920 // Only enumerate directories, non-recursively, including "..". | 1916 // Only enumerate directories, non-recursively, including "..". |
1921 file_util::FileEnumerator f2_dotdot(temp_dir_.path(), false, | 1917 FileEnumerator f2_dotdot(temp_dir_.path(), false, |
1922 file_util::FileEnumerator::DIRECTORIES | | 1918 FileEnumerator::DIRECTORIES | |
1923 file_util::FileEnumerator::INCLUDE_DOT_DOT); | 1919 FileEnumerator::INCLUDE_DOT_DOT); |
1924 FindResultCollector c2_dotdot(f2_dotdot); | 1920 FindResultCollector c2_dotdot(f2_dotdot); |
1925 EXPECT_TRUE(c2_dotdot.HasFile(dir1)); | 1921 EXPECT_TRUE(c2_dotdot.HasFile(dir1)); |
1926 EXPECT_TRUE(c2_dotdot.HasFile(dir2)); | 1922 EXPECT_TRUE(c2_dotdot.HasFile(dir2)); |
1927 EXPECT_TRUE(c2_dotdot.HasFile( | 1923 EXPECT_TRUE(c2_dotdot.HasFile( |
1928 temp_dir_.path().Append(FILE_PATH_LITERAL("..")))); | 1924 temp_dir_.path().Append(FILE_PATH_LITERAL("..")))); |
1929 EXPECT_EQ(c2_dotdot.size(), 3); | 1925 EXPECT_EQ(c2_dotdot.size(), 3); |
1930 | 1926 |
1931 // Enumerate files and directories. | 1927 // Enumerate files and directories. |
1932 file_util::FileEnumerator f3(temp_dir_.path(), true, FILES_AND_DIRECTORIES); | 1928 FileEnumerator f3(temp_dir_.path(), true, FILES_AND_DIRECTORIES); |
1933 FindResultCollector c3(f3); | 1929 FindResultCollector c3(f3); |
1934 EXPECT_TRUE(c3.HasFile(dir1)); | 1930 EXPECT_TRUE(c3.HasFile(dir1)); |
1935 EXPECT_TRUE(c3.HasFile(dir2)); | 1931 EXPECT_TRUE(c3.HasFile(dir2)); |
1936 EXPECT_TRUE(c3.HasFile(file1)); | 1932 EXPECT_TRUE(c3.HasFile(file1)); |
1937 EXPECT_TRUE(c3.HasFile(file2_abs)); | 1933 EXPECT_TRUE(c3.HasFile(file2_abs)); |
1938 EXPECT_TRUE(c3.HasFile(dir2file)); | 1934 EXPECT_TRUE(c3.HasFile(dir2file)); |
1939 EXPECT_TRUE(c3.HasFile(dir2inner)); | 1935 EXPECT_TRUE(c3.HasFile(dir2inner)); |
1940 EXPECT_TRUE(c3.HasFile(dir2innerfile)); | 1936 EXPECT_TRUE(c3.HasFile(dir2innerfile)); |
1941 EXPECT_EQ(c3.size(), 7); | 1937 EXPECT_EQ(c3.size(), 7); |
1942 | 1938 |
1943 // Non-recursive operation. | 1939 // Non-recursive operation. |
1944 file_util::FileEnumerator f4(temp_dir_.path(), false, FILES_AND_DIRECTORIES); | 1940 FileEnumerator f4(temp_dir_.path(), false, FILES_AND_DIRECTORIES); |
1945 FindResultCollector c4(f4); | 1941 FindResultCollector c4(f4); |
1946 EXPECT_TRUE(c4.HasFile(dir2)); | 1942 EXPECT_TRUE(c4.HasFile(dir2)); |
1947 EXPECT_TRUE(c4.HasFile(dir2)); | 1943 EXPECT_TRUE(c4.HasFile(dir2)); |
1948 EXPECT_TRUE(c4.HasFile(file1)); | 1944 EXPECT_TRUE(c4.HasFile(file1)); |
1949 EXPECT_TRUE(c4.HasFile(file2_abs)); | 1945 EXPECT_TRUE(c4.HasFile(file2_abs)); |
1950 EXPECT_EQ(c4.size(), 4); | 1946 EXPECT_EQ(c4.size(), 4); |
1951 | 1947 |
1952 // Enumerate with a pattern. | 1948 // Enumerate with a pattern. |
1953 file_util::FileEnumerator f5(temp_dir_.path(), true, FILES_AND_DIRECTORIES, | 1949 FileEnumerator f5(temp_dir_.path(), true, FILES_AND_DIRECTORIES, |
1954 FILE_PATH_LITERAL("dir*")); | 1950 FILE_PATH_LITERAL("dir*")); |
1955 FindResultCollector c5(f5); | 1951 FindResultCollector c5(f5); |
1956 EXPECT_TRUE(c5.HasFile(dir1)); | 1952 EXPECT_TRUE(c5.HasFile(dir1)); |
1957 EXPECT_TRUE(c5.HasFile(dir2)); | 1953 EXPECT_TRUE(c5.HasFile(dir2)); |
1958 EXPECT_TRUE(c5.HasFile(dir2file)); | 1954 EXPECT_TRUE(c5.HasFile(dir2file)); |
1959 EXPECT_TRUE(c5.HasFile(dir2inner)); | 1955 EXPECT_TRUE(c5.HasFile(dir2inner)); |
1960 EXPECT_TRUE(c5.HasFile(dir2innerfile)); | 1956 EXPECT_TRUE(c5.HasFile(dir2innerfile)); |
1961 EXPECT_EQ(c5.size(), 5); | 1957 EXPECT_EQ(c5.size(), 5); |
1962 | 1958 |
1963 // Make sure the destructor closes the find handle while in the middle of a | 1959 // Make sure the destructor closes the find handle while in the middle of a |
1964 // query to allow TearDown to delete the directory. | 1960 // query to allow TearDown to delete the directory. |
1965 file_util::FileEnumerator f6(temp_dir_.path(), true, FILES_AND_DIRECTORIES); | 1961 FileEnumerator f6(temp_dir_.path(), true, FILES_AND_DIRECTORIES); |
1966 EXPECT_FALSE(f6.Next().value().empty()); // Should have found something | 1962 EXPECT_FALSE(f6.Next().value().empty()); // Should have found something |
1967 // (we don't care what). | 1963 // (we don't care what). |
1968 } | 1964 } |
1969 | 1965 |
1970 TEST_F(FileUtilTest, AppendToFile) { | 1966 TEST_F(FileUtilTest, AppendToFile) { |
1971 FilePath data_dir = | 1967 FilePath data_dir = |
1972 temp_dir_.path().Append(FILE_PATH_LITERAL("FilePathTest")); | 1968 temp_dir_.path().Append(FILE_PATH_LITERAL("FilePathTest")); |
1973 | 1969 |
1974 // Create a fresh, empty copy of this directory. | 1970 // Create a fresh, empty copy of this directory. |
1975 if (file_util::PathExists(data_dir)) { | 1971 if (file_util::PathExists(data_dir)) { |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2455 EXPECT_TRUE( | 2451 EXPECT_TRUE( |
2456 file_util::VerifyPathControlledByUser( | 2452 file_util::VerifyPathControlledByUser( |
2457 base_dir_, text_file_, uid_, ok_gids_)); | 2453 base_dir_, text_file_, uid_, ok_gids_)); |
2458 EXPECT_TRUE( | 2454 EXPECT_TRUE( |
2459 file_util::VerifyPathControlledByUser( | 2455 file_util::VerifyPathControlledByUser( |
2460 sub_dir_, text_file_, uid_, ok_gids_)); | 2456 sub_dir_, text_file_, uid_, ok_gids_)); |
2461 } | 2457 } |
2462 | 2458 |
2463 #endif // defined(OS_POSIX) | 2459 #endif // defined(OS_POSIX) |
2464 | 2460 |
2465 } // namespace | 2461 } // namespace file_util |
OLD | NEW |