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 <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1615 // Note that this timestamp is divisible by two (seconds) - FAT stores | 1615 // Note that this timestamp is divisible by two (seconds) - FAT stores |
1616 // modification times with 2s resolution. | 1616 // modification times with 2s resolution. |
1617 ASSERT_TRUE(base::Time::FromString(L"Tue, 15 Nov 1994, 12:45:26 GMT", | 1617 ASSERT_TRUE(base::Time::FromString(L"Tue, 15 Nov 1994, 12:45:26 GMT", |
1618 &modification_time)); | 1618 &modification_time)); |
1619 ASSERT_TRUE(file_util::SetLastModifiedTime(foobar, modification_time)); | 1619 ASSERT_TRUE(file_util::SetLastModifiedTime(foobar, modification_time)); |
1620 file_util::FileInfo file_info; | 1620 file_util::FileInfo file_info; |
1621 ASSERT_TRUE(file_util::GetFileInfo(foobar, &file_info)); | 1621 ASSERT_TRUE(file_util::GetFileInfo(foobar, &file_info)); |
1622 ASSERT_TRUE(file_info.last_modified == modification_time); | 1622 ASSERT_TRUE(file_info.last_modified == modification_time); |
1623 } | 1623 } |
1624 | 1624 |
| 1625 TEST_F(FileUtilTest, IsDirectoryEmpty) { |
| 1626 FilePath empty_dir = test_dir_.Append(FILE_PATH_LITERAL("EmptyDir")); |
| 1627 |
| 1628 ASSERT_FALSE(file_util::PathExists(empty_dir)); |
| 1629 |
| 1630 ASSERT_TRUE(file_util::CreateDirectory(empty_dir)); |
| 1631 |
| 1632 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir)); |
| 1633 |
| 1634 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt"))); |
| 1635 std::string bar("baz"); |
| 1636 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length())); |
| 1637 |
| 1638 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir)); |
| 1639 } |
| 1640 |
1625 } // namespace | 1641 } // namespace |
OLD | NEW |