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

Side by Side Diff: base/file_util_unittest.cc

Issue 6903022: Removed wchar_t from Time::FromString (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed unnecessary blankline. Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/metrics/field_trial.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 } 1772 }
1773 ASSERT_TRUE(file_util::CreateDirectory(data_dir)); 1773 ASSERT_TRUE(file_util::CreateDirectory(data_dir));
1774 1774
1775 FilePath foobar(data_dir.Append(FILE_PATH_LITERAL("foobar.txt"))); 1775 FilePath foobar(data_dir.Append(FILE_PATH_LITERAL("foobar.txt")));
1776 std::string data("hello"); 1776 std::string data("hello");
1777 ASSERT_TRUE(file_util::WriteFile(foobar, data.c_str(), data.length())); 1777 ASSERT_TRUE(file_util::WriteFile(foobar, data.c_str(), data.length()));
1778 1778
1779 base::Time access_time; 1779 base::Time access_time;
1780 // This timestamp is divisible by one day (in local timezone), 1780 // This timestamp is divisible by one day (in local timezone),
1781 // to make it work on FAT too. 1781 // to make it work on FAT too.
1782 ASSERT_TRUE(base::Time::FromString(L"Wed, 16 Nov 1994, 00:00:00", 1782 ASSERT_TRUE(base::Time::FromString("Wed, 16 Nov 1994, 00:00:00",
1783 &access_time)); 1783 &access_time));
1784 1784
1785 base::Time modification_time; 1785 base::Time modification_time;
1786 // Note that this timestamp is divisible by two (seconds) - FAT stores 1786 // Note that this timestamp is divisible by two (seconds) - FAT stores
1787 // modification times with 2s resolution. 1787 // modification times with 2s resolution.
1788 ASSERT_TRUE(base::Time::FromString(L"Tue, 15 Nov 1994, 12:45:26 GMT", 1788 ASSERT_TRUE(base::Time::FromString("Tue, 15 Nov 1994, 12:45:26 GMT",
1789 &modification_time)); 1789 &modification_time));
1790 1790
1791 ASSERT_TRUE(file_util::TouchFile(foobar, access_time, modification_time)); 1791 ASSERT_TRUE(file_util::TouchFile(foobar, access_time, modification_time));
1792 base::PlatformFileInfo file_info; 1792 base::PlatformFileInfo file_info;
1793 ASSERT_TRUE(file_util::GetFileInfo(foobar, &file_info)); 1793 ASSERT_TRUE(file_util::GetFileInfo(foobar, &file_info));
1794 EXPECT_EQ(file_info.last_accessed.ToInternalValue(), 1794 EXPECT_EQ(file_info.last_accessed.ToInternalValue(),
1795 access_time.ToInternalValue()); 1795 access_time.ToInternalValue());
1796 EXPECT_EQ(file_info.last_modified.ToInternalValue(), 1796 EXPECT_EQ(file_info.last_modified.ToInternalValue(),
1797 modification_time.ToInternalValue()); 1797 modification_time.ToInternalValue());
1798 } 1798 }
1799 1799
1800 TEST_F(FileUtilTest, IsDirectoryEmpty) { 1800 TEST_F(FileUtilTest, IsDirectoryEmpty) {
1801 FilePath empty_dir = temp_dir_.path().Append(FILE_PATH_LITERAL("EmptyDir")); 1801 FilePath empty_dir = temp_dir_.path().Append(FILE_PATH_LITERAL("EmptyDir"));
1802 1802
1803 ASSERT_FALSE(file_util::PathExists(empty_dir)); 1803 ASSERT_FALSE(file_util::PathExists(empty_dir));
1804 1804
1805 ASSERT_TRUE(file_util::CreateDirectory(empty_dir)); 1805 ASSERT_TRUE(file_util::CreateDirectory(empty_dir));
1806 1806
1807 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir)); 1807 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir));
1808 1808
1809 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt"))); 1809 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt")));
1810 std::string bar("baz"); 1810 std::string bar("baz");
1811 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length())); 1811 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length()));
1812 1812
1813 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir)); 1813 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir));
1814 } 1814 }
1815 1815
1816 } // namespace 1816 } // namespace
OLDNEW
« no previous file with comments | « no previous file | base/metrics/field_trial.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698