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

Unified Diff: minidump/minidump_exception_writer_test.cc

Issue 674153002: minidump: Change the ownership model (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years, 2 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
« no previous file with comments | « minidump/minidump_exception_writer.cc ('k') | minidump/minidump_file_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: minidump/minidump_exception_writer_test.cc
diff --git a/minidump/minidump_exception_writer_test.cc b/minidump/minidump_exception_writer_test.cc
index 899ba47dee624306ee0f025292dcbb954aa6e166..ce41fb4c398e7d1d7fca983a7224cf118323a964 100644
--- a/minidump/minidump_exception_writer_test.cc
+++ b/minidump/minidump_exception_writer_test.cc
@@ -93,15 +93,15 @@ void ExpectExceptionStream(const MINIDUMP_EXCEPTION_STREAM* expected,
TEST(MinidumpExceptionWriter, Minimal) {
MinidumpFileWriter minidump_file_writer;
- MinidumpExceptionWriter exception_writer;
+ auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter());
const uint32_t kSeed = 100;
- MinidumpContextX86Writer context_x86_writer;
- InitializeMinidumpContextX86(context_x86_writer.context(), kSeed);
- exception_writer.SetContext(&context_x86_writer);
+ auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
+ InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
+ exception_writer->SetContext(context_x86_writer.Pass());
- minidump_file_writer.AddStream(&exception_writer);
+ minidump_file_writer.AddStream(exception_writer.Pass());
StringFileWriter file_writer;
ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
@@ -124,7 +124,7 @@ TEST(MinidumpExceptionWriter, Minimal) {
TEST(MinidumpExceptionWriter, Standard) {
MinidumpFileWriter minidump_file_writer;
- MinidumpExceptionWriter exception_writer;
+ auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter());
const uint32_t kSeed = 200;
const uint32_t kThreadID = 1;
@@ -136,30 +136,30 @@ TEST(MinidumpExceptionWriter, Standard) {
const uint64_t kExceptionInformation1 = 7;
const uint64_t kExceptionInformation2 = 7;
- MinidumpContextX86Writer context_x86_writer;
- InitializeMinidumpContextX86(context_x86_writer.context(), kSeed);
- exception_writer.SetContext(&context_x86_writer);
+ auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
+ InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
+ exception_writer->SetContext(context_x86_writer.Pass());
- exception_writer.SetThreadID(kThreadID);
- exception_writer.SetExceptionCode(kExceptionCode);
- exception_writer.SetExceptionFlags(kExceptionFlags);
- exception_writer.SetExceptionRecord(kExceptionRecord);
- exception_writer.SetExceptionAddress(kExceptionAddress);
+ exception_writer->SetThreadID(kThreadID);
+ exception_writer->SetExceptionCode(kExceptionCode);
+ exception_writer->SetExceptionFlags(kExceptionFlags);
+ exception_writer->SetExceptionRecord(kExceptionRecord);
+ exception_writer->SetExceptionAddress(kExceptionAddress);
// Set a lot of exception information at first, and then replace it with less.
// This tests that the exception that is written does not contain the
// “garbage” from the initial SetExceptionInformation() call.
std::vector<uint64_t> exception_information(EXCEPTION_MAXIMUM_PARAMETERS,
0x5a5a5a5a5a5a5a5a);
- exception_writer.SetExceptionInformation(exception_information);
+ exception_writer->SetExceptionInformation(exception_information);
exception_information.clear();
exception_information.push_back(kExceptionInformation0);
exception_information.push_back(kExceptionInformation1);
exception_information.push_back(kExceptionInformation2);
- exception_writer.SetExceptionInformation(exception_information);
+ exception_writer->SetExceptionInformation(exception_information);
- minidump_file_writer.AddStream(&exception_writer);
+ minidump_file_writer.AddStream(exception_writer.Pass());
StringFileWriter file_writer;
ASSERT_TRUE(minidump_file_writer.WriteEverything(&file_writer));
@@ -194,9 +194,9 @@ TEST(MinidumpExceptionWriter, Standard) {
TEST(MinidumpExceptionWriterDeathTest, NoContext) {
MinidumpFileWriter minidump_file_writer;
- MinidumpExceptionWriter exception_writer;
+ auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter());
- minidump_file_writer.AddStream(&exception_writer);
+ minidump_file_writer.AddStream(exception_writer.Pass());
StringFileWriter file_writer;
ASSERT_DEATH(minidump_file_writer.WriteEverything(&file_writer), "context_");
« no previous file with comments | « minidump/minidump_exception_writer.cc ('k') | minidump/minidump_file_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698