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

Unified Diff: minidump/minidump_exception_writer_test.cc

Issue 670853002: minidump: Migrate the rest of the tests to MinidumpWritableAtLocationDescriptor<>() (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_crashpad_info_writer_test.cc ('k') | minidump/minidump_file_writer_test.cc » ('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 e1cad612f6120905bb49f9852933e9998eeb8137..2b5132747fecd05575e07820d9859cd6dedac672 100644
--- a/minidump/minidump_exception_writer_test.cc
+++ b/minidump/minidump_exception_writer_test.cc
@@ -27,6 +27,7 @@
#include "minidump/minidump_file_writer.h"
#include "minidump/test/minidump_context_test_util.h"
#include "minidump/test/minidump_file_writer_test_util.h"
+#include "minidump/test/minidump_writable_test_util.h"
#include "util/file/string_file_writer.h"
namespace crashpad {
@@ -50,11 +51,12 @@ void GetExceptionStream(const std::string& file_contents,
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, 0));
ASSERT_EQ(kMinidumpStreamTypeException, directory[0].StreamType);
- ASSERT_GE(directory[0].Location.DataSize, sizeof(MINIDUMP_EXCEPTION_STREAM));
- ASSERT_EQ(kExceptionStreamOffset, directory[0].Location.Rva);
+ EXPECT_EQ(kExceptionStreamOffset, directory[0].Location.Rva);
- *exception_stream = reinterpret_cast<const MINIDUMP_EXCEPTION_STREAM*>(
- &file_contents[kExceptionStreamOffset]);
+ *exception_stream =
+ MinidumpWritableAtLocationDescriptor<MINIDUMP_EXCEPTION_STREAM>(
+ file_contents, directory[0].Location);
+ ASSERT_TRUE(exception_stream);
}
// The MINIDUMP_EXCEPTION_STREAMs |expected| and |observed| are compared against
@@ -83,13 +85,9 @@ void ExpectExceptionStream(const MINIDUMP_EXCEPTION_STREAM* expected,
EXPECT_EQ(expected->ExceptionRecord.ExceptionInformation[index],
observed->ExceptionRecord.ExceptionInformation[index]);
}
- EXPECT_EQ(expected->ThreadContext.DataSize, observed->ThreadContext.DataSize);
- ASSERT_NE(0u, observed->ThreadContext.DataSize);
- ASSERT_NE(0u, observed->ThreadContext.Rva);
- ASSERT_GE(file_contents.size(),
- observed->ThreadContext.Rva + observed->ThreadContext.DataSize);
- *context = reinterpret_cast<const MinidumpContextX86*>(
- &file_contents[observed->ThreadContext.Rva]);
+ *context = MinidumpWritableAtLocationDescriptor<MinidumpContextX86>(
+ file_contents, observed->ThreadContext);
+ ASSERT_TRUE(context);
}
TEST(MinidumpExceptionWriter, Minimal) {
« no previous file with comments | « minidump/minidump_crashpad_info_writer_test.cc ('k') | minidump/minidump_file_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698