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

Unified Diff: minidump/minidump_memory_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_file_writer_test.cc ('k') | minidump/minidump_misc_info_writer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: minidump/minidump_memory_writer_test.cc
diff --git a/minidump/minidump_memory_writer_test.cc b/minidump/minidump_memory_writer_test.cc
index cd45b78d31e4240f6770ed95f167746fd14a76ff..66a3fc6106e58dc46960f8b1ce62cac712588f85 100644
--- a/minidump/minidump_memory_writer_test.cc
+++ b/minidump/minidump_memory_writer_test.cc
@@ -47,25 +47,25 @@ void GetMemoryListStream(const std::string& file_contents,
ASSERT_GE(file_contents.size(), kMemoryDescriptorsOffset);
+ 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, expected_streams, 0));
+ ASSERT_TRUE(directory);
- const MINIDUMP_DIRECTORY* directory =
- reinterpret_cast<const MINIDUMP_DIRECTORY*>(
- &file_contents[kDirectoryOffset]);
-
+ size_t directory_index = 0;
if (expected_streams > 1) {
- ASSERT_EQ(kBogusStreamType, directory->StreamType);
- ASSERT_EQ(0u, directory->Location.DataSize);
- ASSERT_EQ(kMemoryListStreamOffset, directory->Location.Rva);
- ++directory;
+ ASSERT_EQ(kBogusStreamType, directory[directory_index].StreamType);
+ ASSERT_EQ(0u, directory[directory_index].Location.DataSize);
+ ASSERT_EQ(kMemoryListStreamOffset, directory[directory_index].Location.Rva);
+ ++directory_index;
}
- ASSERT_EQ(kMinidumpStreamTypeMemoryList, directory->StreamType);
- ASSERT_GE(directory->Location.DataSize, sizeof(MINIDUMP_MEMORY_LIST));
- ASSERT_EQ(kMemoryListStreamOffset, directory->Location.Rva);
+ ASSERT_EQ(kMinidumpStreamTypeMemoryList,
+ directory[directory_index].StreamType);
+ ASSERT_GE(directory[directory_index].Location.DataSize,
+ sizeof(MINIDUMP_MEMORY_LIST));
+ ASSERT_EQ(kMemoryListStreamOffset, directory[directory_index].Location.Rva);
*memory_list = reinterpret_cast<const MINIDUMP_MEMORY_LIST*>(
&file_contents[kMemoryListStreamOffset]);
@@ -73,7 +73,7 @@ void GetMemoryListStream(const std::string& file_contents,
ASSERT_EQ(sizeof(MINIDUMP_MEMORY_LIST) +
(*memory_list)->NumberOfMemoryRanges *
sizeof(MINIDUMP_MEMORY_DESCRIPTOR),
- directory->Location.DataSize);
+ directory[directory_index].Location.DataSize);
}
TEST(MinidumpMemoryWriter, EmptyMemoryList) {
« no previous file with comments | « minidump/minidump_file_writer_test.cc ('k') | minidump/minidump_misc_info_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698