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 "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 test_dir_ = test_dir_.AppendASCII("LzmaUtilTest"); | 24 test_dir_ = test_dir_.AppendASCII("LzmaUtilTest"); |
25 | 25 |
26 // Create a fresh, empty copy of this test directory. | 26 // Create a fresh, empty copy of this test directory. |
27 file_util::Delete(test_dir_, true); | 27 file_util::Delete(test_dir_, true); |
28 file_util::CreateDirectoryW(test_dir_); | 28 file_util::CreateDirectoryW(test_dir_); |
29 ASSERT_TRUE(file_util::PathExists(test_dir_)); | 29 ASSERT_TRUE(file_util::PathExists(test_dir_)); |
30 } | 30 } |
31 | 31 |
32 virtual void TearDown() { | 32 virtual void TearDown() { |
33 // Clean up test directory | 33 // Clean up test directory |
34 ASSERT_TRUE(file_util::Delete(test_dir_, false)); | 34 ASSERT_TRUE(file_util::Delete(test_dir_, true)); |
35 ASSERT_FALSE(file_util::PathExists(test_dir_)); | 35 ASSERT_FALSE(file_util::PathExists(test_dir_)); |
36 } | 36 } |
37 | 37 |
38 // The path to temporary directory used to contain the test operations. | 38 // The path to temporary directory used to contain the test operations. |
39 FilePath test_dir_; | 39 FilePath test_dir_; |
40 | 40 |
41 // The path to input data used in tests. | 41 // The path to input data used in tests. |
42 FilePath data_dir_; | 42 FilePath data_dir_; |
43 }; | 43 }; |
44 }; | 44 }; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 archive = data_dir_.AppendASCII("archive2.7z"); | 123 archive = data_dir_.AppendASCII("archive2.7z"); |
124 EXPECT_EQ(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), | 124 EXPECT_EQ(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), |
125 &unpacked_file), NO_ERROR); | 125 &unpacked_file), NO_ERROR); |
126 EXPECT_TRUE(file_util::PathExists(extract_dir.AppendASCII("b.exe"))); | 126 EXPECT_TRUE(file_util::PathExists(extract_dir.AppendASCII("b.exe"))); |
127 EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("b.exe").value()); | 127 EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("b.exe").value()); |
128 | 128 |
129 archive = data_dir_.AppendASCII("invalid_archive.7z"); | 129 archive = data_dir_.AppendASCII("invalid_archive.7z"); |
130 EXPECT_NE(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), | 130 EXPECT_NE(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), |
131 &unpacked_file), NO_ERROR); | 131 &unpacked_file), NO_ERROR); |
132 } | 132 } |
OLD | NEW |