| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 {L"/foo/bar/", L"/foo/bar"}, | 304 {L"/foo/bar/", L"/foo/bar"}, |
| 305 {L"/foo/bar//", L"/foo/bar"}, | 305 {L"/foo/bar//", L"/foo/bar"}, |
| 306 {L"/foo/bar", L"/foo"}, | 306 {L"/foo/bar", L"/foo"}, |
| 307 {L"/foo/bar./", L"/foo/bar."}, | 307 {L"/foo/bar./", L"/foo/bar."}, |
| 308 {L"/", L"/"}, | 308 {L"/", L"/"}, |
| 309 {L".", L"."}, | 309 {L".", L"."}, |
| 310 {L"..", L"."}, // yes, ".." technically lives in "." | 310 {L"..", L"."}, // yes, ".." technically lives in "." |
| 311 #endif | 311 #endif |
| 312 }; | 312 }; |
| 313 | 313 |
| 314 #if defined(OS_WIN) |
| 315 // This function is deprecated, and only exists on Windows anymore. |
| 314 TEST_F(FileUtilTest, GetDirectoryFromPath) { | 316 TEST_F(FileUtilTest, GetDirectoryFromPath) { |
| 315 for (unsigned int i = 0; i < arraysize(dir_cases); ++i) { | 317 for (unsigned int i = 0; i < arraysize(dir_cases); ++i) { |
| 316 const dir_case& dir = dir_cases[i]; | 318 const dir_case& dir = dir_cases[i]; |
| 317 const std::wstring parent = | 319 const std::wstring parent = |
| 318 file_util::GetDirectoryFromPath(dir.full_path); | 320 file_util::GetDirectoryFromPath(dir.full_path); |
| 319 EXPECT_EQ(dir.directory, parent); | 321 EXPECT_EQ(dir.directory, parent); |
| 320 } | 322 } |
| 321 } | 323 } |
| 324 #endif |
| 322 | 325 |
| 323 TEST_F(FileUtilTest, CountFilesCreatedAfter) { | 326 TEST_F(FileUtilTest, CountFilesCreatedAfter) { |
| 324 // Create old file (that we don't want to count) | 327 // Create old file (that we don't want to count) |
| 325 FilePath old_file_name = test_dir_.Append(FILE_PATH_LITERAL("Old File.txt")); | 328 FilePath old_file_name = test_dir_.Append(FILE_PATH_LITERAL("Old File.txt")); |
| 326 CreateTextFile(old_file_name, L"Just call me Mr. Creakybits"); | 329 CreateTextFile(old_file_name, L"Just call me Mr. Creakybits"); |
| 327 | 330 |
| 328 // Age to perfection | 331 // Age to perfection |
| 329 #if defined(OS_WIN) | 332 #if defined(OS_WIN) |
| 330 PlatformThread::Sleep(100); | 333 PlatformThread::Sleep(100); |
| 331 #elif defined(OS_POSIX) | 334 #elif defined(OS_POSIX) |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 // modification times with 2s resolution. | 1410 // modification times with 2s resolution. |
| 1408 ASSERT_TRUE(base::Time::FromString(L"Tue, 15 Nov 1994, 12:45:26 GMT", | 1411 ASSERT_TRUE(base::Time::FromString(L"Tue, 15 Nov 1994, 12:45:26 GMT", |
| 1409 &modification_time)); | 1412 &modification_time)); |
| 1410 ASSERT_TRUE(file_util::SetLastModifiedTime(foobar, modification_time)); | 1413 ASSERT_TRUE(file_util::SetLastModifiedTime(foobar, modification_time)); |
| 1411 file_util::FileInfo file_info; | 1414 file_util::FileInfo file_info; |
| 1412 ASSERT_TRUE(file_util::GetFileInfo(foobar, &file_info)); | 1415 ASSERT_TRUE(file_util::GetFileInfo(foobar, &file_info)); |
| 1413 ASSERT_TRUE(file_info.last_modified == modification_time); | 1416 ASSERT_TRUE(file_info.last_modified == modification_time); |
| 1414 } | 1417 } |
| 1415 | 1418 |
| 1416 } // namespace | 1419 } // namespace |
| OLD | NEW |