Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: chrome/installer/util/lzma_file_allocator_unittest.cc

Issue 2341693002: Re-write many calls to WrapUnique() with MakeUnique() (Closed)
Patch Set: Change std::string() back to "" to fix compile Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 TEST_F(LzmaFileAllocatorTest, SizeIsZeroTest) { 57 TEST_F(LzmaFileAllocatorTest, SizeIsZeroTest) {
58 LzmaFileAllocator allocator(temp_dir_.path()); 58 LzmaFileAllocator allocator(temp_dir_.path());
59 char* s = reinterpret_cast<char*>(IAlloc_Alloc(&allocator, 0)); 59 char* s = reinterpret_cast<char*>(IAlloc_Alloc(&allocator, 0));
60 EXPECT_EQ(s, nullptr); 60 EXPECT_EQ(s, nullptr);
61 61
62 IAlloc_Free(&allocator, s); 62 IAlloc_Free(&allocator, s);
63 } 63 }
64 64
65 TEST_F(LzmaFileAllocatorTest, DeleteAfterCloseTest) { 65 TEST_F(LzmaFileAllocatorTest, DeleteAfterCloseTest) {
66 std::unique_ptr<LzmaFileAllocator> allocator = 66 std::unique_ptr<LzmaFileAllocator> allocator =
67 base::WrapUnique(new LzmaFileAllocator(temp_dir_.path())); 67 base::MakeUnique<LzmaFileAllocator>(temp_dir_.path());
68 base::FilePath file_path = allocator->mapped_file_path_; 68 base::FilePath file_path = allocator->mapped_file_path_;
69 ASSERT_TRUE(base::PathExists(file_path)); 69 ASSERT_TRUE(base::PathExists(file_path));
70 allocator.reset(); 70 allocator.reset();
71 ASSERT_FALSE(base::PathExists(file_path)); 71 ASSERT_FALSE(base::PathExists(file_path));
72 } 72 }
73 73
74 TEST_F(LzmaFileAllocatorTest, ErrorAndFallbackTest) { 74 TEST_F(LzmaFileAllocatorTest, ErrorAndFallbackTest) {
75 LzmaFileAllocator allocator(temp_dir_.path()); 75 LzmaFileAllocator allocator(temp_dir_.path());
76 allocator.mapped_file_.Close(); 76 allocator.mapped_file_.Close();
77 char* s = reinterpret_cast<char*>(IAlloc_Alloc(&allocator, 10)); 77 char* s = reinterpret_cast<char*>(IAlloc_Alloc(&allocator, 10));
78 EXPECT_NE(nullptr, s); 78 EXPECT_NE(nullptr, s);
79 ASSERT_FALSE(allocator.file_mapping_handle_.IsValid()); 79 ASSERT_FALSE(allocator.file_mapping_handle_.IsValid());
80 EXPECT_EQ(static_cast<DWORD>(MEM_PRIVATE), GetMemoryType(s)); 80 EXPECT_EQ(static_cast<DWORD>(MEM_PRIVATE), GetMemoryType(s));
81 81
82 IAlloc_Free(&allocator, s); 82 IAlloc_Free(&allocator, s);
83 } 83 }
OLDNEW
« no previous file with comments | « chrome/installer/util/browser_distribution.cc ('k') | chrome/installer/util/scoped_user_protocol_entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698