| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/installer/util/lzma_file_allocator.h" | 5 #include "chrome/installer/util/lzma_file_allocator.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 |
| 7 #include <string> | 9 #include <string> |
| 8 | 10 |
| 9 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 15 |
| 14 class LzmaFileAllocatorTest : public testing::Test { | 16 class LzmaFileAllocatorTest : public testing::Test { |
| 15 protected: | 17 protected: |
| 16 void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } | 18 void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 TEST_F(LzmaFileAllocatorTest, ErrorAndFallbackTest) { | 73 TEST_F(LzmaFileAllocatorTest, ErrorAndFallbackTest) { |
| 72 LzmaFileAllocator allocator(temp_dir_.path()); | 74 LzmaFileAllocator allocator(temp_dir_.path()); |
| 73 allocator.mapped_file_.Close(); | 75 allocator.mapped_file_.Close(); |
| 74 char* s = reinterpret_cast<char*>(IAlloc_Alloc(&allocator, 10)); | 76 char* s = reinterpret_cast<char*>(IAlloc_Alloc(&allocator, 10)); |
| 75 EXPECT_NE(nullptr, s); | 77 EXPECT_NE(nullptr, s); |
| 76 ASSERT_FALSE(allocator.file_mapping_handle_.IsValid()); | 78 ASSERT_FALSE(allocator.file_mapping_handle_.IsValid()); |
| 77 EXPECT_EQ(static_cast<DWORD>(MEM_PRIVATE), GetMemoryType(s)); | 79 EXPECT_EQ(static_cast<DWORD>(MEM_PRIVATE), GetMemoryType(s)); |
| 78 | 80 |
| 79 IAlloc_Free(&allocator, s); | 81 IAlloc_Free(&allocator, s); |
| 80 } | 82 } |
| OLD | NEW |