| 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 EXPECT_EQ(30ll, size_f2); | 456 EXPECT_EQ(30ll, size_f2); |
| 457 | 457 |
| 458 FilePath subsubdir_path = subdir_path.Append(FPL("Level3")); | 458 FilePath subsubdir_path = subdir_path.Append(FPL("Level3")); |
| 459 file_util::CreateDirectory(subsubdir_path); | 459 file_util::CreateDirectory(subsubdir_path); |
| 460 | 460 |
| 461 FilePath file_03 = subsubdir_path.Append(FPL("The file 03.txt")); | 461 FilePath file_03 = subsubdir_path.Append(FPL("The file 03.txt")); |
| 462 CreateTextFile(file_03, L"123"); | 462 CreateTextFile(file_03, L"123"); |
| 463 | 463 |
| 464 int64 computed_size = file_util::ComputeDirectorySize(test_dir_); | 464 int64 computed_size = file_util::ComputeDirectorySize(test_dir_); |
| 465 EXPECT_EQ(size_f1 + size_f2 + 3, computed_size); | 465 EXPECT_EQ(size_f1 + size_f2 + 3, computed_size); |
| 466 |
| 467 computed_size = file_util::ComputeFilesSize(test_dir_, FPL("The file*")); |
| 468 EXPECT_EQ(size_f1, computed_size); |
| 469 |
| 470 computed_size = file_util::ComputeFilesSize(test_dir_, FPL("bla*")); |
| 471 EXPECT_EQ(0, computed_size); |
| 466 } | 472 } |
| 467 | 473 |
| 468 TEST_F(FileUtilTest, NormalizeFilePathBasic) { | 474 TEST_F(FileUtilTest, NormalizeFilePathBasic) { |
| 469 // Create a directory under the test dir. Because we create it, | 475 // Create a directory under the test dir. Because we create it, |
| 470 // we know it is not a link. | 476 // we know it is not a link. |
| 471 FilePath file_a_path = test_dir_.Append(FPL("file_a")); | 477 FilePath file_a_path = test_dir_.Append(FPL("file_a")); |
| 472 FilePath dir_path = test_dir_.Append(FPL("dir")); | 478 FilePath dir_path = test_dir_.Append(FPL("dir")); |
| 473 FilePath file_b_path = dir_path.Append(FPL("file_b")); | 479 FilePath file_b_path = dir_path.Append(FPL("file_b")); |
| 474 file_util::CreateDirectory(dir_path); | 480 file_util::CreateDirectory(dir_path); |
| 475 | 481 |
| (...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1842 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir)); | 1848 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir)); |
| 1843 | 1849 |
| 1844 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt"))); | 1850 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt"))); |
| 1845 std::string bar("baz"); | 1851 std::string bar("baz"); |
| 1846 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length())); | 1852 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length())); |
| 1847 | 1853 |
| 1848 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir)); | 1854 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir)); |
| 1849 } | 1855 } |
| 1850 | 1856 |
| 1851 } // namespace | 1857 } // namespace |
| OLD | NEW |