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

Unified Diff: minidump/minidump_crashpad_info_writer_test.cc

Issue 664283002: Refactor minidump test utilities for MinidumpWritable, … (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: 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.gyp ('k') | minidump/minidump_exception_writer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: minidump/minidump_crashpad_info_writer_test.cc
diff --git a/minidump/minidump_crashpad_info_writer_test.cc b/minidump/minidump_crashpad_info_writer_test.cc
index 090b4a223011544d086f036a7fa8f0793ceb229f..3cbbfb6b6196197a631694b23d4f420afbc51c8d 100644
--- a/minidump/minidump_crashpad_info_writer_test.cc
+++ b/minidump/minidump_crashpad_info_writer_test.cc
@@ -48,18 +48,15 @@ void GetCrashpadInfoStream(
EXPECT_GE(file_contents.size(), kFileSize);
}
+ const MINIDUMP_DIRECTORY* directory;
const MINIDUMP_HEADER* header =
- reinterpret_cast<const MINIDUMP_HEADER*>(&file_contents[0]);
-
+ MinidumpHeaderAtStart(file_contents, &directory);
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, 1, 0));
+ ASSERT_TRUE(directory);
- const MINIDUMP_DIRECTORY* directory =
- reinterpret_cast<const MINIDUMP_DIRECTORY*>(
- &file_contents[kDirectoryOffset]);
-
- ASSERT_EQ(kMinidumpStreamTypeCrashpadInfo, directory->StreamType);
- ASSERT_EQ(sizeof(MinidumpCrashpadInfo), directory->Location.DataSize);
- ASSERT_EQ(kCrashpadInfoStreamOffset, directory->Location.Rva);
+ ASSERT_EQ(kMinidumpStreamTypeCrashpadInfo, directory[0].StreamType);
+ ASSERT_EQ(sizeof(MinidumpCrashpadInfo), directory[0].Location.DataSize);
+ ASSERT_EQ(kCrashpadInfoStreamOffset, directory[0].Location.Rva);
*crashpad_info = reinterpret_cast<const MinidumpCrashpadInfo*>(
&file_contents[kCrashpadInfoStreamOffset]);
@@ -136,18 +133,18 @@ TEST(MinidumpCrashpadInfoWriter, SimpleAnnotations) {
ASSERT_EQ(2u, simple_annotations->count);
- EXPECT_EQ(
- kKey1,
- MinidumpUTF8StringAtRVA(file_writer, simple_annotations->entries[0].key));
+ EXPECT_EQ(kKey1,
+ MinidumpUTF8StringAtRVAAsString(
+ file_writer.string(), simple_annotations->entries[0].key));
EXPECT_EQ(kValue1,
- MinidumpUTF8StringAtRVA(file_writer,
- simple_annotations->entries[0].value));
- EXPECT_EQ(
- kKey0,
- MinidumpUTF8StringAtRVA(file_writer, simple_annotations->entries[1].key));
+ MinidumpUTF8StringAtRVAAsString(
+ file_writer.string(), simple_annotations->entries[0].value));
+ EXPECT_EQ(kKey0,
+ MinidumpUTF8StringAtRVAAsString(
+ file_writer.string(), simple_annotations->entries[1].key));
EXPECT_EQ(kValue0,
- MinidumpUTF8StringAtRVA(file_writer,
- simple_annotations->entries[1].value));
+ MinidumpUTF8StringAtRVAAsString(
+ file_writer.string(), simple_annotations->entries[1].value));
}
} // namespace
« no previous file with comments | « minidump/minidump.gyp ('k') | minidump/minidump_exception_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698