| 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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 EXPECT_EQ(file_contents, read_contents); | 682 EXPECT_EQ(file_contents, read_contents); |
| 683 | 683 |
| 684 DeleteFile(target_file.value().c_str()); | 684 DeleteFile(target_file.value().c_str()); |
| 685 DeleteFile(link_file.value().c_str()); | 685 DeleteFile(link_file.value().c_str()); |
| 686 CoUninitialize(); | 686 CoUninitialize(); |
| 687 } | 687 } |
| 688 #endif | 688 #endif |
| 689 | 689 |
| 690 TEST_F(FileUtilTest, CreateTemporaryFileNameTest) { | 690 TEST_F(FileUtilTest, CreateTemporaryFileNameTest) { |
| 691 std::wstring temp_file; | 691 std::wstring temp_file; |
| 692 file_util::CreateTemporaryFileName(&temp_file); | 692 ASSERT_TRUE(file_util::CreateTemporaryFileName(&temp_file)); |
| 693 EXPECT_TRUE(file_util::PathExists(temp_file)); | 693 EXPECT_TRUE(file_util::PathExists(temp_file)); |
| 694 EXPECT_TRUE(file_util::Delete(temp_file, false)); | 694 EXPECT_TRUE(file_util::Delete(temp_file, false)); |
| 695 } | 695 } |
| 696 | 696 |
| 697 TEST_F(FileUtilTest, CreateNewTempDirectoryTest) { | 697 TEST_F(FileUtilTest, CreateNewTempDirectoryTest) { |
| 698 std::wstring temp_dir; | 698 std::wstring temp_dir; |
| 699 file_util::CreateNewTempDirectory(std::wstring(), &temp_dir); | 699 ASSERT_TRUE(file_util::CreateNewTempDirectory(std::wstring(), &temp_dir)); |
| 700 EXPECT_TRUE(file_util::PathExists(temp_dir)); | 700 EXPECT_TRUE(file_util::PathExists(temp_dir)); |
| 701 EXPECT_TRUE(file_util::Delete(temp_dir, false)); | 701 EXPECT_TRUE(file_util::Delete(temp_dir, false)); |
| 702 } | 702 } |
| 703 | 703 |
| 704 TEST_F(FileUtilTest, CreateDirectoryTest) { | 704 TEST_F(FileUtilTest, CreateDirectoryTest) { |
| 705 FilePath test_root = | 705 FilePath test_root = |
| 706 test_dir_.Append(FILE_PATH_LITERAL("create_directory_test")); | 706 test_dir_.Append(FILE_PATH_LITERAL("create_directory_test")); |
| 707 #if defined(OS_WIN) | 707 #if defined(OS_WIN) |
| 708 FilePath test_path = | 708 FilePath test_path = |
| 709 test_root.Append(FILE_PATH_LITERAL("dir\\tree\\likely\\doesnt\\exist\\")); | 709 test_root.Append(FILE_PATH_LITERAL("dir\\tree\\likely\\doesnt\\exist\\")); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 | 919 |
| 920 // Make sure the destructor closes the find handle while in the middle of a | 920 // Make sure the destructor closes the find handle while in the middle of a |
| 921 // query to allow TearDown to delete the directory. | 921 // query to allow TearDown to delete the directory. |
| 922 file_util::FileEnumerator f6(test_dir_.ToWStringHack(), true, | 922 file_util::FileEnumerator f6(test_dir_.ToWStringHack(), true, |
| 923 file_util::FileEnumerator::FILES_AND_DIRECTORIES); | 923 file_util::FileEnumerator::FILES_AND_DIRECTORIES); |
| 924 EXPECT_FALSE(f6.Next().empty()); // Should have found something | 924 EXPECT_FALSE(f6.Next().empty()); // Should have found something |
| 925 // (we don't care what). | 925 // (we don't care what). |
| 926 } | 926 } |
| 927 | 927 |
| 928 } // namespace | 928 } // namespace |
| OLD | NEW |