| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include <windows.h> |
| 6 |
| 7 #include "base/file_path.h" |
| 8 #include "base/path_service.h" |
| 9 #include "base/scoped_temp_dir.h" |
| 10 #include "chrome/installer/mini_installer/decompress.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 |
| 13 class MiniDecompressTest : public testing::Test { |
| 14 protected: |
| 15 virtual void SetUp() { |
| 16 } |
| 17 virtual void TearDown() { |
| 18 } |
| 19 }; |
| 20 |
| 21 TEST_F(MiniDecompressTest, ExpandTest) { |
| 22 FilePath source_path; |
| 23 PathService::Get(base::DIR_SOURCE_ROOT, &source_path); |
| 24 source_path = source_path.Append(FILE_PATH_LITERAL("chrome")) |
| 25 .Append(FILE_PATH_LITERAL("installer")) |
| 26 .Append(FILE_PATH_LITERAL("test")) |
| 27 .Append(FILE_PATH_LITERAL("data")) |
| 28 .Append(FILE_PATH_LITERAL("SETUP.EX_")); |
| 29 |
| 30 // Prepare a temp folder that will be automatically deleted along with |
| 31 // our temporary test data. |
| 32 ScopedTempDir temp_dir; |
| 33 EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 34 FilePath dest_path(temp_dir.path().Append(FILE_PATH_LITERAL("setup.exe"))); |
| 35 |
| 36 // Decompress our test file. |
| 37 EXPECT_TRUE(mini_installer::Expand( |
| 38 const_cast<wchar_t*>(source_path.value().c_str()), |
| 39 dest_path.value().c_str())); |
| 40 |
| 41 // Check if the expanded file is a valid executable. |
| 42 DWORD type = static_cast<DWORD>(-1); |
| 43 EXPECT_TRUE(GetBinaryType(dest_path.value().c_str(), &type)); |
| 44 EXPECT_EQ(SCS_32BIT_BINARY, type); |
| 45 } |
| OLD | NEW |