OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <winioctl.h> | 9 #include <winioctl.h> |
10 #include <shellapi.h> | 10 #include <shellapi.h> |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 {L"/foo/bar/", L"/foo/bar"}, | 308 {L"/foo/bar/", L"/foo/bar"}, |
309 {L"/foo/bar//", L"/foo/bar"}, | 309 {L"/foo/bar//", L"/foo/bar"}, |
310 {L"/foo/bar", L"/foo"}, | 310 {L"/foo/bar", L"/foo"}, |
311 {L"/foo/bar./", L"/foo/bar."}, | 311 {L"/foo/bar./", L"/foo/bar."}, |
312 {L"/", L"/"}, | 312 {L"/", L"/"}, |
313 {L".", L"."}, | 313 {L".", L"."}, |
314 {L"..", L"."}, // yes, ".." technically lives in "." | 314 {L"..", L"."}, // yes, ".." technically lives in "." |
315 #endif | 315 #endif |
316 }; | 316 }; |
317 | 317 |
318 #if defined(OS_WIN) | |
319 // This function is deprecated, and only exists on Windows anymore. | |
320 TEST_F(FileUtilTest, GetDirectoryFromPath) { | |
321 for (unsigned int i = 0; i < arraysize(dir_cases); ++i) { | |
322 const dir_case& dir = dir_cases[i]; | |
323 const std::wstring parent = | |
324 file_util::GetDirectoryFromPath(dir.full_path); | |
325 EXPECT_EQ(dir.directory, parent); | |
326 } | |
327 } | |
328 #endif | |
329 | |
330 // Flaky, http://crbug.com/46246 | 318 // Flaky, http://crbug.com/46246 |
331 TEST_F(FileUtilTest, FLAKY_CountFilesCreatedAfter) { | 319 TEST_F(FileUtilTest, FLAKY_CountFilesCreatedAfter) { |
332 // Create old file (that we don't want to count) | 320 // Create old file (that we don't want to count) |
333 FilePath old_file_name = | 321 FilePath old_file_name = |
334 temp_dir_.path().Append(FILE_PATH_LITERAL("Old File.txt")); | 322 temp_dir_.path().Append(FILE_PATH_LITERAL("Old File.txt")); |
335 CreateTextFile(old_file_name, L"Just call me Mr. Creakybits"); | 323 CreateTextFile(old_file_name, L"Just call me Mr. Creakybits"); |
336 | 324 |
337 // Age to perfection | 325 // Age to perfection |
338 #if defined(OS_WIN) | 326 #if defined(OS_WIN) |
339 base::PlatformThread::Sleep(100); | 327 base::PlatformThread::Sleep(100); |
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir)); | 1804 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir)); |
1817 | 1805 |
1818 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt"))); | 1806 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt"))); |
1819 std::string bar("baz"); | 1807 std::string bar("baz"); |
1820 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length())); | 1808 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length())); |
1821 | 1809 |
1822 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir)); | 1810 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir)); |
1823 } | 1811 } |
1824 | 1812 |
1825 } // namespace | 1813 } // namespace |
OLD | NEW |