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

Unified Diff: third_party/crashpad/crashpad/minidump/minidump_thread_writer_test.cc

Issue 1911823002: Convert //third_party from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update crashpad's README.chromium Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/crashpad/crashpad/minidump/minidump_thread_writer_test.cc
diff --git a/third_party/crashpad/crashpad/minidump/minidump_thread_writer_test.cc b/third_party/crashpad/crashpad/minidump/minidump_thread_writer_test.cc
index 86a5d936f21adbd4c408e617db1bf011ffe57fa0..06982a4aad253c3520a02001b00445bc11e2c1a7 100644
--- a/third_party/crashpad/crashpad/minidump/minidump_thread_writer_test.cc
+++ b/third_party/crashpad/crashpad/minidump/minidump_thread_writer_test.cc
@@ -12,19 +12,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include "minidump/minidump_thread_writer.h"
-
#include <string>
#include <utility>
#include "base/compiler_specific.h"
#include "base/format_macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "gtest/gtest.h"
#include "minidump/minidump_context_writer.h"
#include "minidump/minidump_file_writer.h"
#include "minidump/minidump_memory_writer.h"
#include "minidump/minidump_thread_id_map.h"
+#include "minidump/minidump_thread_writer.h"
#include "minidump/test/minidump_context_test_util.h"
#include "minidump/test/minidump_file_writer_test_util.h"
#include "minidump/test/minidump_memory_writer_test_util.h"
@@ -78,7 +78,7 @@ void GetThreadListStream(const std::string& file_contents,
TEST(MinidumpThreadWriter, EmptyThreadList) {
MinidumpFileWriter minidump_file_writer;
- auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
+ auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
minidump_file_writer.AddStream(std::move(thread_list_writer));
@@ -139,7 +139,7 @@ void ExpectThread(const MINIDUMP_THREAD* expected,
TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
MinidumpFileWriter minidump_file_writer;
- auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
+ auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
const uint32_t kThreadID = 0x11111111;
const uint32_t kSuspendCount = 1;
@@ -148,14 +148,14 @@ TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
const uint64_t kTEB = 0x55555555;
const uint32_t kSeed = 123;
- auto thread_writer = make_scoped_ptr(new MinidumpThreadWriter());
+ auto thread_writer = base::WrapUnique(new MinidumpThreadWriter());
thread_writer->SetThreadID(kThreadID);
thread_writer->SetSuspendCount(kSuspendCount);
thread_writer->SetPriorityClass(kPriorityClass);
thread_writer->SetPriority(kPriority);
thread_writer->SetTEB(kTEB);
- auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
+ auto context_x86_writer = base::WrapUnique(new MinidumpContextX86Writer());
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
thread_writer->SetContext(std::move(context_x86_writer));
@@ -198,7 +198,7 @@ TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
MinidumpFileWriter minidump_file_writer;
- auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
+ auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
const uint32_t kThreadID = 0x22222222;
const uint32_t kSuspendCount = 2;
@@ -210,19 +210,20 @@ TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
const uint8_t kMemoryValue = 99;
const uint32_t kSeed = 456;
- auto thread_writer = make_scoped_ptr(new MinidumpThreadWriter());
+ auto thread_writer = base::WrapUnique(new MinidumpThreadWriter());
thread_writer->SetThreadID(kThreadID);
thread_writer->SetSuspendCount(kSuspendCount);
thread_writer->SetPriorityClass(kPriorityClass);
thread_writer->SetPriority(kPriority);
thread_writer->SetTEB(kTEB);
- auto memory_writer = make_scoped_ptr(
+ auto memory_writer = base::WrapUnique(
new TestMinidumpMemoryWriter(kMemoryBase, kMemorySize, kMemoryValue));
thread_writer->SetStack(std::move(memory_writer));
MSVC_SUPPRESS_WARNING(4316); // Object allocated on heap may not be aligned.
- auto context_amd64_writer = make_scoped_ptr(new MinidumpContextAMD64Writer());
+ auto context_amd64_writer =
+ base::WrapUnique(new MinidumpContextAMD64Writer());
InitializeMinidumpContextAMD64(context_amd64_writer->context(), kSeed);
thread_writer->SetContext(std::move(context_amd64_writer));
@@ -274,8 +275,8 @@ TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
MinidumpFileWriter minidump_file_writer;
- auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
- auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
+ auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
+ auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
thread_list_writer->SetMemoryListWriter(memory_list_writer.get());
const uint32_t kThreadID0 = 1111111;
@@ -288,18 +289,18 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
const uint8_t kMemoryValue0 = 11;
const uint32_t kSeed0 = 1;
- auto thread_writer_0 = make_scoped_ptr(new MinidumpThreadWriter());
+ auto thread_writer_0 = base::WrapUnique(new MinidumpThreadWriter());
thread_writer_0->SetThreadID(kThreadID0);
thread_writer_0->SetSuspendCount(kSuspendCount0);
thread_writer_0->SetPriorityClass(kPriorityClass0);
thread_writer_0->SetPriority(kPriority0);
thread_writer_0->SetTEB(kTEB0);
- auto memory_writer_0 = make_scoped_ptr(
+ auto memory_writer_0 = base::WrapUnique(
new TestMinidumpMemoryWriter(kMemoryBase0, kMemorySize0, kMemoryValue0));
thread_writer_0->SetStack(std::move(memory_writer_0));
- auto context_x86_writer_0 = make_scoped_ptr(new MinidumpContextX86Writer());
+ auto context_x86_writer_0 = base::WrapUnique(new MinidumpContextX86Writer());
InitializeMinidumpContextX86(context_x86_writer_0->context(), kSeed0);
thread_writer_0->SetContext(std::move(context_x86_writer_0));
@@ -315,18 +316,18 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
const uint8_t kMemoryValue1 = 22;
const uint32_t kSeed1 = 2;
- auto thread_writer_1 = make_scoped_ptr(new MinidumpThreadWriter());
+ auto thread_writer_1 = base::WrapUnique(new MinidumpThreadWriter());
thread_writer_1->SetThreadID(kThreadID1);
thread_writer_1->SetSuspendCount(kSuspendCount1);
thread_writer_1->SetPriorityClass(kPriorityClass1);
thread_writer_1->SetPriority(kPriority1);
thread_writer_1->SetTEB(kTEB1);
- auto memory_writer_1 = make_scoped_ptr(
+ auto memory_writer_1 = base::WrapUnique(
new TestMinidumpMemoryWriter(kMemoryBase1, kMemorySize1, kMemoryValue1));
thread_writer_1->SetStack(std::move(memory_writer_1));
- auto context_x86_writer_1 = make_scoped_ptr(new MinidumpContextX86Writer());
+ auto context_x86_writer_1 = base::WrapUnique(new MinidumpContextX86Writer());
InitializeMinidumpContextX86(context_x86_writer_1->context(), kSeed1);
thread_writer_1->SetContext(std::move(context_x86_writer_1));
@@ -342,18 +343,18 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
const uint8_t kMemoryValue2 = 33;
const uint32_t kSeed2 = 3;
- auto thread_writer_2 = make_scoped_ptr(new MinidumpThreadWriter());
+ auto thread_writer_2 = base::WrapUnique(new MinidumpThreadWriter());
thread_writer_2->SetThreadID(kThreadID2);
thread_writer_2->SetSuspendCount(kSuspendCount2);
thread_writer_2->SetPriorityClass(kPriorityClass2);
thread_writer_2->SetPriority(kPriority2);
thread_writer_2->SetTEB(kTEB2);
- auto memory_writer_2 = make_scoped_ptr(
+ auto memory_writer_2 = base::WrapUnique(
new TestMinidumpMemoryWriter(kMemoryBase2, kMemorySize2, kMemoryValue2));
thread_writer_2->SetStack(std::move(memory_writer_2));
- auto context_x86_writer_2 = make_scoped_ptr(new MinidumpContextX86Writer());
+ auto context_x86_writer_2 = base::WrapUnique(new MinidumpContextX86Writer());
InitializeMinidumpContextX86(context_x86_writer_2->context(), kSeed2);
thread_writer_2->SetContext(std::move(context_x86_writer_2));
@@ -592,7 +593,7 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
thread_snapshot->SetThreadSpecificDataAddress(expect_threads[index].Teb);
if (expect_threads[index].Stack.Memory.DataSize) {
- auto memory_snapshot = make_scoped_ptr(new TestMemorySnapshot());
+ auto memory_snapshot = base::WrapUnique(new TestMemorySnapshot());
memory_snapshot->SetAddress(
expect_threads[index].Stack.StartOfMemoryRange);
memory_snapshot->SetSize(expect_threads[index].Stack.Memory.DataSize);
@@ -603,7 +604,7 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
Traits::InitializeCPUContext(thread_snapshot->MutableContext(),
context_seeds[index]);
- auto teb_snapshot = make_scoped_ptr(new TestMemorySnapshot());
+ auto teb_snapshot = base::WrapUnique(new TestMemorySnapshot());
teb_snapshot->SetAddress(expect_threads[index].Teb);
teb_snapshot->SetSize(kTebSize);
teb_snapshot->SetValue(static_cast<char>('t' + index));
@@ -612,8 +613,8 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
thread_snapshots.push_back(thread_snapshot);
}
- auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
- auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
+ auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
+ auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
thread_list_writer->SetMemoryListWriter(memory_list_writer.get());
MinidumpThreadIDMap thread_id_map;
thread_list_writer->InitializeFromSnapshot(thread_snapshots, &thread_id_map);
@@ -693,9 +694,9 @@ TEST(MinidumpThreadWriter, InitializeFromSnapshot_ThreadIDCollision) {
TEST(MinidumpThreadWriterDeathTest, NoContext) {
MinidumpFileWriter minidump_file_writer;
- auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
+ auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
- auto thread_writer = make_scoped_ptr(new MinidumpThreadWriter());
+ auto thread_writer = base::WrapUnique(new MinidumpThreadWriter());
thread_list_writer->AddThread(std::move(thread_writer));
minidump_file_writer.AddStream(std::move(thread_list_writer));

Powered by Google App Engine
This is Rietveld 408576698