Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: base/file_util_unittest.cc

Issue 2153002: file_util: Convert the wstring version of IsDirectoryEmpty to FilePath. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: fix nit Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/file_util.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « base/file_util.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698