| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 392 |
| 393 EXPECT_TRUE(file_util::Move(dir_name_from, dir_name_to)); | 393 EXPECT_TRUE(file_util::Move(dir_name_from, dir_name_to)); |
| 394 | 394 |
| 395 // Check everything has been moved. | 395 // Check everything has been moved. |
| 396 EXPECT_FALSE(file_util::PathExists(dir_name_from)); | 396 EXPECT_FALSE(file_util::PathExists(dir_name_from)); |
| 397 EXPECT_FALSE(file_util::PathExists(file_name_from)); | 397 EXPECT_FALSE(file_util::PathExists(file_name_from)); |
| 398 EXPECT_TRUE(file_util::PathExists(dir_name_to)); | 398 EXPECT_TRUE(file_util::PathExists(dir_name_to)); |
| 399 EXPECT_TRUE(file_util::PathExists(file_name_to)); | 399 EXPECT_TRUE(file_util::PathExists(file_name_to)); |
| 400 } | 400 } |
| 401 | 401 |
| 402 // TODO(erikkay): implement | 402 #if !defined(OS_MACOSX) |
| 403 #if defined(OS_WIN) | |
| 404 TEST_F(FileUtilTest, CopyDirectoryRecursively) { | 403 TEST_F(FileUtilTest, CopyDirectoryRecursively) { |
| 405 // Create a directory. | 404 // Create a directory. |
| 406 std::wstring dir_name_from(test_dir_); | 405 std::wstring dir_name_from(test_dir_); |
| 407 file_util::AppendToPath(&dir_name_from, L"Copy_From_Subdir"); | 406 file_util::AppendToPath(&dir_name_from, L"Copy_From_Subdir"); |
| 408 file_util::CreateDirectory(dir_name_from.c_str()); | 407 file_util::CreateDirectory(dir_name_from.c_str()); |
| 409 ASSERT_TRUE(file_util::PathExists(dir_name_from)); | 408 ASSERT_TRUE(file_util::PathExists(dir_name_from)); |
| 410 | 409 |
| 411 // Create a file under the directory. | 410 // Create a file under the directory. |
| 412 std::wstring file_name_from(dir_name_from); | 411 std::wstring file_name_from(dir_name_from); |
| 413 file_util::AppendToPath(&file_name_from, L"Copy_Test_File.txt"); | 412 file_util::AppendToPath(&file_name_from, L"Copy_Test_File.txt"); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 EXPECT_EQ(file_contents, read_contents); | 688 EXPECT_EQ(file_contents, read_contents); |
| 690 | 689 |
| 691 DeleteFile(target_file.c_str()); | 690 DeleteFile(target_file.c_str()); |
| 692 DeleteFile(link_file.c_str()); | 691 DeleteFile(link_file.c_str()); |
| 693 CoUninitialize(); | 692 CoUninitialize(); |
| 694 } | 693 } |
| 695 #endif | 694 #endif |
| 696 | 695 |
| 697 TEST_F(FileUtilTest, CreateTemporaryFileNameTest) { | 696 TEST_F(FileUtilTest, CreateTemporaryFileNameTest) { |
| 698 std::wstring temp_file; | 697 std::wstring temp_file; |
| 699 file_util::CreateTemporaryFileName(&temp_file); | 698 ASSERT_TRUE(file_util::CreateTemporaryFileName(&temp_file)); |
| 700 EXPECT_TRUE(file_util::PathExists(temp_file)); | 699 EXPECT_TRUE(file_util::PathExists(temp_file)); |
| 701 EXPECT_TRUE(file_util::Delete(temp_file, false)); | 700 EXPECT_TRUE(file_util::Delete(temp_file, false)); |
| 702 } | 701 } |
| 703 | 702 |
| 704 TEST_F(FileUtilTest, CreateNewTempDirectoryTest) { | 703 TEST_F(FileUtilTest, CreateNewTempDirectoryTest) { |
| 705 std::wstring temp_dir; | 704 std::wstring temp_dir; |
| 706 file_util::CreateNewTempDirectory(std::wstring(), &temp_dir); | 705 file_util::CreateNewTempDirectory(std::wstring(), &temp_dir); |
| 707 EXPECT_TRUE(file_util::PathExists(temp_dir)); | 706 EXPECT_TRUE(file_util::PathExists(temp_dir)); |
| 708 EXPECT_TRUE(file_util::Delete(temp_dir, false)); | 707 EXPECT_TRUE(file_util::Delete(temp_dir, false)); |
| 709 } | 708 } |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 | 911 |
| 913 // Make sure the destructor closes the find handle while in the middle of a | 912 // Make sure the destructor closes the find handle while in the middle of a |
| 914 // query to allow TearDown to delete the directory. | 913 // query to allow TearDown to delete the directory. |
| 915 file_util::FileEnumerator f6(test_dir_, true, | 914 file_util::FileEnumerator f6(test_dir_, true, |
| 916 file_util::FileEnumerator::FILES_AND_DIRECTORIES); | 915 file_util::FileEnumerator::FILES_AND_DIRECTORIES); |
| 917 EXPECT_FALSE(f6.Next().empty()); // Should have found something | 916 EXPECT_FALSE(f6.Next().empty()); // Should have found something |
| 918 // (we don't care what). | 917 // (we don't care what). |
| 919 } | 918 } |
| 920 | 919 |
| 921 } // namespace | 920 } // namespace |
| OLD | NEW |