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

Side by Side Diff: base/file_util_unittest.cc

Issue 11896097: Remove GetFileCreationLocalTime. It is unused. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | « base/file_util_posix.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 1496
1497 // Check everything has been copied. 1497 // Check everything has been copied.
1498 EXPECT_TRUE(file_util::PathExists(file_name_from)); 1498 EXPECT_TRUE(file_util::PathExists(file_name_from));
1499 EXPECT_TRUE(file_util::PathExists(dest_file)); 1499 EXPECT_TRUE(file_util::PathExists(dest_file));
1500 const std::wstring read_contents = ReadTextFile(dest_file); 1500 const std::wstring read_contents = ReadTextFile(dest_file);
1501 EXPECT_EQ(file_contents, read_contents); 1501 EXPECT_EQ(file_contents, read_contents);
1502 EXPECT_TRUE(file_util::PathExists(dest_file2_test)); 1502 EXPECT_TRUE(file_util::PathExists(dest_file2_test));
1503 EXPECT_TRUE(file_util::PathExists(dest_file2)); 1503 EXPECT_TRUE(file_util::PathExists(dest_file2));
1504 } 1504 }
1505 1505
1506 // TODO(erikkay): implement
1507 #if defined(OS_WIN)
1508 TEST_F(FileUtilTest, GetFileCreationLocalTime) {
1509 FilePath file_name = temp_dir_.path().Append(L"Test File.txt");
1510
1511 SYSTEMTIME start_time;
1512 GetLocalTime(&start_time);
1513 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100));
1514 CreateTextFile(file_name, L"New file!");
1515 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100));
1516 SYSTEMTIME end_time;
1517 GetLocalTime(&end_time);
1518
1519 SYSTEMTIME file_creation_time;
1520 file_util::GetFileCreationLocalTime(file_name.value(), &file_creation_time);
1521
1522 FILETIME start_filetime;
1523 SystemTimeToFileTime(&start_time, &start_filetime);
1524 FILETIME end_filetime;
1525 SystemTimeToFileTime(&end_time, &end_filetime);
1526 FILETIME file_creation_filetime;
1527 SystemTimeToFileTime(&file_creation_time, &file_creation_filetime);
1528
1529 EXPECT_EQ(-1, CompareFileTime(&start_filetime, &file_creation_filetime)) <<
1530 "start time: " << FileTimeAsUint64(start_filetime) << ", " <<
1531 "creation time: " << FileTimeAsUint64(file_creation_filetime);
1532
1533 EXPECT_EQ(-1, CompareFileTime(&file_creation_filetime, &end_filetime)) <<
1534 "creation time: " << FileTimeAsUint64(file_creation_filetime) << ", " <<
1535 "end time: " << FileTimeAsUint64(end_filetime);
1536
1537 ASSERT_TRUE(DeleteFile(file_name.value().c_str()));
1538 }
1539 #endif
1540
1541 // file_util winds up using autoreleased objects on the Mac, so this needs 1506 // file_util winds up using autoreleased objects on the Mac, so this needs
1542 // to be a PlatformTest. 1507 // to be a PlatformTest.
1543 typedef PlatformTest ReadOnlyFileUtilTest; 1508 typedef PlatformTest ReadOnlyFileUtilTest;
1544 1509
1545 TEST_F(ReadOnlyFileUtilTest, ContentsEqual) { 1510 TEST_F(ReadOnlyFileUtilTest, ContentsEqual) {
1546 FilePath data_dir; 1511 FilePath data_dir;
1547 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir)); 1512 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir));
1548 data_dir = data_dir.Append(FILE_PATH_LITERAL("base")) 1513 data_dir = data_dir.Append(FILE_PATH_LITERAL("base"))
1549 .Append(FILE_PATH_LITERAL("data")) 1514 .Append(FILE_PATH_LITERAL("data"))
1550 .Append(FILE_PATH_LITERAL("file_util_unittest")); 1515 .Append(FILE_PATH_LITERAL("file_util_unittest"));
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 file_util::VerifyPathControlledByUser( 2405 file_util::VerifyPathControlledByUser(
2441 base_dir_, text_file_, uid_, ok_gids_)); 2406 base_dir_, text_file_, uid_, ok_gids_));
2442 EXPECT_TRUE( 2407 EXPECT_TRUE(
2443 file_util::VerifyPathControlledByUser( 2408 file_util::VerifyPathControlledByUser(
2444 sub_dir_, text_file_, uid_, ok_gids_)); 2409 sub_dir_, text_file_, uid_, ok_gids_));
2445 } 2410 }
2446 2411
2447 #endif // defined(OS_POSIX) 2412 #endif // defined(OS_POSIX)
2448 2413
2449 } // namespace 2414 } // namespace
OLDNEW
« no previous file with comments | « base/file_util_posix.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698