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

Unified Diff: minidump/minidump_memory_writer_test.cc

Issue 460933004: Add MinidumpModuleWriter, MinidumpModuleListWriter, related classes, and their test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Don’t suffix uint64_t constants Created 6 years, 4 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_extensions.cc ('k') | minidump/minidump_module_writer.h » ('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 3015bbe62df845c680e0baff9819d31aec7f8db0..f275d8adddb9991a0367d7c77fe62de7ea8b6304 100644
--- a/minidump/minidump_memory_writer_test.cc
+++ b/minidump/minidump_memory_writer_test.cc
@@ -19,6 +19,7 @@
#include "base/basictypes.h"
#include "gtest/gtest.h"
+#include "minidump/minidump_extensions.h"
#include "minidump/minidump_file_writer.h"
#include "minidump/minidump_stream_writer.h"
#include "minidump/minidump_test_util.h"
@@ -248,27 +249,36 @@ TEST(MinidumpMemoryWriter, TwoMemoryRegions) {
EXPECT_EQ(2u, memory_list->NumberOfMemoryRanges);
MINIDUMP_MEMORY_DESCRIPTOR expected;
- expected.StartOfMemoryRange = kBaseAddress1;
- expected.Memory.DataSize = kSize1;
- expected.Memory.Rva =
- sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
- sizeof(MINIDUMP_MEMORY_LIST) +
- memory_list->NumberOfMemoryRanges * sizeof(MINIDUMP_MEMORY_DESCRIPTOR);
- ExpectMemoryDescriptorAndContents(&expected,
- &memory_list->MemoryRanges[0],
- file_writer.string(),
- kValue1,
- false);
- expected.StartOfMemoryRange = kBaseAddress2;
- expected.Memory.DataSize = kSize2;
- expected.Memory.Rva = memory_list->MemoryRanges[0].Memory.Rva +
- memory_list->MemoryRanges[0].Memory.DataSize;
- ExpectMemoryDescriptorAndContents(&expected,
- &memory_list->MemoryRanges[1],
- file_writer.string(),
- kValue2,
- true);
+ {
+ SCOPED_TRACE("region 0");
+
+ expected.StartOfMemoryRange = kBaseAddress1;
+ expected.Memory.DataSize = kSize1;
+ expected.Memory.Rva =
+ sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
+ sizeof(MINIDUMP_MEMORY_LIST) +
+ memory_list->NumberOfMemoryRanges * sizeof(MINIDUMP_MEMORY_DESCRIPTOR);
+ ExpectMemoryDescriptorAndContents(&expected,
+ &memory_list->MemoryRanges[0],
+ file_writer.string(),
+ kValue1,
+ false);
+ }
+
+ {
+ SCOPED_TRACE("region 1");
+
+ expected.StartOfMemoryRange = kBaseAddress2;
+ expected.Memory.DataSize = kSize2;
+ expected.Memory.Rva = memory_list->MemoryRanges[0].Memory.Rva +
+ memory_list->MemoryRanges[0].Memory.DataSize;
+ ExpectMemoryDescriptorAndContents(&expected,
+ &memory_list->MemoryRanges[1],
+ file_writer.string(),
+ kValue2,
+ true);
+ }
}
class TestMemoryStream final : public internal::MinidumpStreamWriter {
@@ -346,27 +356,36 @@ TEST(MinidumpMemoryWriter, ExtraMemory) {
EXPECT_EQ(2u, memory_list->NumberOfMemoryRanges);
MINIDUMP_MEMORY_DESCRIPTOR expected;
- expected.StartOfMemoryRange = kBaseAddress1;
- expected.Memory.DataSize = kSize1;
- expected.Memory.Rva =
- sizeof(MINIDUMP_HEADER) + 2 * sizeof(MINIDUMP_DIRECTORY) +
- sizeof(MINIDUMP_MEMORY_LIST) +
- memory_list->NumberOfMemoryRanges * sizeof(MINIDUMP_MEMORY_DESCRIPTOR);
- ExpectMemoryDescriptorAndContents(&expected,
- &memory_list->MemoryRanges[0],
- file_writer.string(),
- kValue1,
- false);
- expected.StartOfMemoryRange = kBaseAddress2;
- expected.Memory.DataSize = kSize2;
- expected.Memory.Rva = memory_list->MemoryRanges[0].Memory.Rva +
- memory_list->MemoryRanges[0].Memory.DataSize;
- ExpectMemoryDescriptorAndContents(&expected,
- &memory_list->MemoryRanges[1],
- file_writer.string(),
- kValue2,
- true);
+ {
+ SCOPED_TRACE("region 0");
+
+ expected.StartOfMemoryRange = kBaseAddress1;
+ expected.Memory.DataSize = kSize1;
+ expected.Memory.Rva =
+ sizeof(MINIDUMP_HEADER) + 2 * sizeof(MINIDUMP_DIRECTORY) +
+ sizeof(MINIDUMP_MEMORY_LIST) +
+ memory_list->NumberOfMemoryRanges * sizeof(MINIDUMP_MEMORY_DESCRIPTOR);
+ ExpectMemoryDescriptorAndContents(&expected,
+ &memory_list->MemoryRanges[0],
+ file_writer.string(),
+ kValue1,
+ false);
+ }
+
+ {
+ SCOPED_TRACE("region 1");
+
+ expected.StartOfMemoryRange = kBaseAddress2;
+ expected.Memory.DataSize = kSize2;
+ expected.Memory.Rva = memory_list->MemoryRanges[0].Memory.Rva +
+ memory_list->MemoryRanges[0].Memory.DataSize;
+ ExpectMemoryDescriptorAndContents(&expected,
+ &memory_list->MemoryRanges[1],
+ file_writer.string(),
+ kValue2,
+ true);
+ }
}
} // namespace
« no previous file with comments | « minidump/minidump_extensions.cc ('k') | minidump/minidump_module_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698