OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
11 #include "chrome/installer/util/lzma_util.h" | 11 #include "chrome/installer/util/lzma_util.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 class LzmaUtilTest : public testing::Test { | 16 class LzmaUtilTest : public testing::Test { |
17 protected: | 17 protected: |
18 virtual void SetUp() { | 18 void SetUp() override { |
19 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_)); | 19 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_)); |
20 data_dir_ = data_dir_.AppendASCII("installer"); | 20 data_dir_ = data_dir_.AppendASCII("installer"); |
21 ASSERT_TRUE(base::PathExists(data_dir_)); | 21 ASSERT_TRUE(base::PathExists(data_dir_)); |
22 | 22 |
23 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 23 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
24 } | 24 } |
25 | 25 |
26 base::ScopedTempDir temp_dir_; | 26 base::ScopedTempDir temp_dir_; |
27 | 27 |
28 // The path to input data used in tests. | 28 // The path to input data used in tests. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 archive = data_dir_.AppendASCII("archive2.7z"); | 111 archive = data_dir_.AppendASCII("archive2.7z"); |
112 EXPECT_EQ(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), | 112 EXPECT_EQ(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), |
113 &unpacked_file), NO_ERROR); | 113 &unpacked_file), NO_ERROR); |
114 EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("b.exe"))); | 114 EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("b.exe"))); |
115 EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("b.exe").value()); | 115 EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("b.exe").value()); |
116 | 116 |
117 archive = data_dir_.AppendASCII("invalid_archive.7z"); | 117 archive = data_dir_.AppendASCII("invalid_archive.7z"); |
118 EXPECT_NE(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), | 118 EXPECT_NE(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), |
119 &unpacked_file), NO_ERROR); | 119 &unpacked_file), NO_ERROR); |
120 } | 120 } |
OLD | NEW |