| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <windows.h> | 5 #include <windows.h> |
| 6 | 6 |
| 7 #include <fstream> | 7 #include <fstream> |
| 8 #include <iostream> | 8 #include <iostream> |
| 9 | 9 |
| 10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // Create a tempory directory under the test directory. | 32 // Create a tempory directory under the test directory. |
| 33 temp_dir_ = test_dir_.AppendASCII("temp"); | 33 temp_dir_ = test_dir_.AppendASCII("temp"); |
| 34 file_util::CreateDirectoryW(temp_dir_); | 34 file_util::CreateDirectoryW(temp_dir_); |
| 35 | 35 |
| 36 ASSERT_TRUE(file_util::PathExists(test_dir_)); | 36 ASSERT_TRUE(file_util::PathExists(test_dir_)); |
| 37 ASSERT_TRUE(file_util::PathExists(temp_dir_)); | 37 ASSERT_TRUE(file_util::PathExists(temp_dir_)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 virtual void TearDown() { | 40 virtual void TearDown() { |
| 41 // Clean up test directory | 41 // Clean up test directory |
| 42 ASSERT_TRUE(file_util::Delete(test_dir_, false)); | 42 ASSERT_TRUE(file_util::Delete(test_dir_, true)); |
| 43 ASSERT_FALSE(file_util::PathExists(test_dir_)); | 43 ASSERT_FALSE(file_util::PathExists(test_dir_)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 // the path to temporary directory used to contain the test operations | 46 // the path to temporary directory used to contain the test operations |
| 47 FilePath test_dir_; | 47 FilePath test_dir_; |
| 48 FilePath temp_dir_; | 48 FilePath temp_dir_; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // Simple function to dump some text into a new file. | 51 // Simple function to dump some text into a new file. |
| 52 void CreateTextFile(const std::wstring& filename, | 52 void CreateTextFile(const std::wstring& filename, |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, to_file)); | 385 EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, to_file)); |
| 386 | 386 |
| 387 // test rollback() | 387 // test rollback() |
| 388 work_item->Rollback(); | 388 work_item->Rollback(); |
| 389 | 389 |
| 390 EXPECT_TRUE(file_util::PathExists(from_dir)); | 390 EXPECT_TRUE(file_util::PathExists(from_dir)); |
| 391 EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, from_file)); | 391 EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, from_file)); |
| 392 EXPECT_TRUE(file_util::PathExists(to_dir)); | 392 EXPECT_TRUE(file_util::PathExists(to_dir)); |
| 393 EXPECT_EQ(0, ReadTextFile(to_file.value()).compare(text_content_1)); | 393 EXPECT_EQ(0, ReadTextFile(to_file.value()).compare(text_content_1)); |
| 394 } | 394 } |
| OLD | NEW |