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

Unified Diff: third_party/crashpad/crashpad/minidump/minidump_thread_writer_test.cc

Issue 2804713002: Update Crashpad to b4095401639ebe2ad33169e5c1d994065cbff1b8 (Closed)
Patch Set: Created 3 years, 8 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
Index: third_party/crashpad/crashpad/minidump/minidump_thread_writer_test.cc
diff --git a/third_party/crashpad/crashpad/minidump/minidump_thread_writer_test.cc b/third_party/crashpad/crashpad/minidump/minidump_thread_writer_test.cc
index 61332363c0c726d8667222f299fc180f298e6ff8..0fa511bacfecd191733a3f109d7708c3a79239df 100644
--- a/third_party/crashpad/crashpad/minidump/minidump_thread_writer_test.cc
+++ b/third_party/crashpad/crashpad/minidump/minidump_thread_writer_test.cc
@@ -61,15 +61,15 @@ void GetThreadListStream(const std::string& file_contents,
ASSERT_NO_FATAL_FAILURE(VerifyMinidumpHeader(header, kExpectedStreams, 0));
ASSERT_TRUE(directory);
- ASSERT_EQ(kMinidumpStreamTypeThreadList, directory[0].StreamType);
- EXPECT_EQ(kThreadListStreamOffset, directory[0].Location.Rva);
+ ASSERT_EQ(directory[0].StreamType, kMinidumpStreamTypeThreadList);
+ EXPECT_EQ(directory[0].Location.Rva, kThreadListStreamOffset);
*thread_list = MinidumpWritableAtLocationDescriptor<MINIDUMP_THREAD_LIST>(
file_contents, directory[0].Location);
ASSERT_TRUE(thread_list);
if (memory_list) {
- ASSERT_EQ(kMinidumpStreamTypeMemoryList, directory[1].StreamType);
+ ASSERT_EQ(directory[1].StreamType, kMinidumpStreamTypeMemoryList);
*memory_list = MinidumpWritableAtLocationDescriptor<MINIDUMP_MEMORY_LIST>(
file_contents, directory[1].Location);
@@ -86,15 +86,15 @@ TEST(MinidumpThreadWriter, EmptyThreadList) {
StringFile string_file;
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
- ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
- sizeof(MINIDUMP_THREAD_LIST),
- string_file.string().size());
+ ASSERT_EQ(string_file.string().size(),
+ sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
+ sizeof(MINIDUMP_THREAD_LIST));
const MINIDUMP_THREAD_LIST* thread_list = nullptr;
ASSERT_NO_FATAL_FAILURE(
GetThreadListStream(string_file.string(), &thread_list, nullptr));
- EXPECT_EQ(0u, thread_list->NumberOfThreads);
+ EXPECT_EQ(thread_list->NumberOfThreads, 0u);
}
// The MINIDUMP_THREADs |expected| and |observed| are compared against each
@@ -109,30 +109,30 @@ void ExpectThread(const MINIDUMP_THREAD* expected,
const std::string& file_contents,
const MINIDUMP_MEMORY_DESCRIPTOR** stack,
const void** context_base) {
- EXPECT_EQ(expected->ThreadId, observed->ThreadId);
- EXPECT_EQ(expected->SuspendCount, observed->SuspendCount);
- EXPECT_EQ(expected->PriorityClass, observed->PriorityClass);
- EXPECT_EQ(expected->Priority, observed->Priority);
- EXPECT_EQ(expected->Teb, observed->Teb);
-
- EXPECT_EQ(expected->Stack.StartOfMemoryRange,
- observed->Stack.StartOfMemoryRange);
- EXPECT_EQ(expected->Stack.Memory.DataSize, observed->Stack.Memory.DataSize);
+ EXPECT_EQ(observed->ThreadId, expected->ThreadId);
+ EXPECT_EQ(observed->SuspendCount, expected->SuspendCount);
+ EXPECT_EQ(observed->PriorityClass, expected->PriorityClass);
+ EXPECT_EQ(observed->Priority, expected->Priority);
+ EXPECT_EQ(observed->Teb, expected->Teb);
+
+ EXPECT_EQ(observed->Stack.StartOfMemoryRange,
+ expected->Stack.StartOfMemoryRange);
+ EXPECT_EQ(observed->Stack.Memory.DataSize, expected->Stack.Memory.DataSize);
if (stack) {
- ASSERT_NE(0u, observed->Stack.Memory.DataSize);
- ASSERT_NE(0u, observed->Stack.Memory.Rva);
+ ASSERT_NE(observed->Stack.Memory.DataSize, 0u);
+ ASSERT_NE(observed->Stack.Memory.Rva, 0u);
ASSERT_GE(file_contents.size(),
observed->Stack.Memory.Rva + observed->Stack.Memory.DataSize);
*stack = &observed->Stack;
} else {
- EXPECT_EQ(0u, observed->Stack.StartOfMemoryRange);
- EXPECT_EQ(0u, observed->Stack.Memory.DataSize);
- EXPECT_EQ(0u, observed->Stack.Memory.Rva);
+ EXPECT_EQ(observed->Stack.StartOfMemoryRange, 0u);
+ EXPECT_EQ(observed->Stack.Memory.DataSize, 0u);
+ EXPECT_EQ(observed->Stack.Memory.Rva, 0u);
}
- EXPECT_EQ(expected->ThreadContext.DataSize, observed->ThreadContext.DataSize);
- ASSERT_NE(0u, observed->ThreadContext.DataSize);
- ASSERT_NE(0u, observed->ThreadContext.Rva);
+ EXPECT_EQ(observed->ThreadContext.DataSize, expected->ThreadContext.DataSize);
+ ASSERT_NE(observed->ThreadContext.DataSize, 0u);
+ ASSERT_NE(observed->ThreadContext.Rva, 0u);
ASSERT_GE(file_contents.size(),
observed->ThreadContext.Rva + expected->ThreadContext.DataSize);
*context_base = &file_contents[observed->ThreadContext.Rva];
@@ -166,16 +166,16 @@ TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
StringFile string_file;
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
- ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
+ ASSERT_EQ(string_file.string().size(),
+ sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
sizeof(MINIDUMP_THREAD_LIST) + 1 * sizeof(MINIDUMP_THREAD) +
- 1 * sizeof(MinidumpContextX86),
- string_file.string().size());
+ 1 * sizeof(MinidumpContextX86));
const MINIDUMP_THREAD_LIST* thread_list = nullptr;
ASSERT_NO_FATAL_FAILURE(
GetThreadListStream(string_file.string(), &thread_list, nullptr));
- EXPECT_EQ(1u, thread_list->NumberOfThreads);
+ EXPECT_EQ(thread_list->NumberOfThreads, 1u);
MINIDUMP_THREAD expected = {};
expected.ThreadId = kThreadID;
@@ -236,16 +236,16 @@ TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
StringFile string_file;
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
- ASSERT_EQ(sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
+ ASSERT_EQ(string_file.string().size(),
+ sizeof(MINIDUMP_HEADER) + sizeof(MINIDUMP_DIRECTORY) +
sizeof(MINIDUMP_THREAD_LIST) + 1 * sizeof(MINIDUMP_THREAD) +
- 1 * sizeof(MinidumpContextAMD64) + kMemorySize,
- string_file.string().size());
+ 1 * sizeof(MinidumpContextAMD64) + kMemorySize);
const MINIDUMP_THREAD_LIST* thread_list = nullptr;
ASSERT_NO_FATAL_FAILURE(
GetThreadListStream(string_file.string(), &thread_list, nullptr));
- EXPECT_EQ(1u, thread_list->NumberOfThreads);
+ EXPECT_EQ(thread_list->NumberOfThreads, 1u);
MINIDUMP_THREAD expected = {};
expected.ThreadId = kThreadID;
@@ -369,21 +369,22 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
StringFile string_file;
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
- ASSERT_EQ(sizeof(MINIDUMP_HEADER) + 2 * sizeof(MINIDUMP_DIRECTORY) +
- sizeof(MINIDUMP_THREAD_LIST) + 3 * sizeof(MINIDUMP_THREAD) +
- sizeof(MINIDUMP_MEMORY_LIST) +
- 3 * sizeof(MINIDUMP_MEMORY_DESCRIPTOR) +
- 3 * sizeof(MinidumpContextX86) + kMemorySize0 + kMemorySize1 +
- kMemorySize2 + 12, // 12 for alignment
- string_file.string().size());
+ ASSERT_EQ(
+ string_file.string().size(),
+ sizeof(MINIDUMP_HEADER) + 2 * sizeof(MINIDUMP_DIRECTORY) +
+ sizeof(MINIDUMP_THREAD_LIST) + 3 * sizeof(MINIDUMP_THREAD) +
+ sizeof(MINIDUMP_MEMORY_LIST) +
+ 3 * sizeof(MINIDUMP_MEMORY_DESCRIPTOR) +
+ 3 * sizeof(MinidumpContextX86) + kMemorySize0 + kMemorySize1 +
+ kMemorySize2 + 12); // 12 for alignment
const MINIDUMP_THREAD_LIST* thread_list = nullptr;
const MINIDUMP_MEMORY_LIST* memory_list = nullptr;
ASSERT_NO_FATAL_FAILURE(
GetThreadListStream(string_file.string(), &thread_list, &memory_list));
- EXPECT_EQ(3u, thread_list->NumberOfThreads);
- EXPECT_EQ(3u, memory_list->NumberOfMemoryRanges);
+ EXPECT_EQ(thread_list->NumberOfThreads, 3u);
+ EXPECT_EQ(memory_list->NumberOfMemoryRanges, 3u);
{
SCOPED_TRACE("thread 0");
@@ -634,8 +635,8 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
ASSERT_NO_FATAL_FAILURE(
GetThreadListStream(string_file.string(), &thread_list, &memory_list));
- ASSERT_EQ(3u, thread_list->NumberOfThreads);
- ASSERT_EQ(5u, memory_list->NumberOfMemoryRanges);
+ ASSERT_EQ(thread_list->NumberOfThreads, 3u);
+ ASSERT_EQ(memory_list->NumberOfMemoryRanges, 5u);
size_t memory_index = 0;
for (size_t index = 0; index < thread_list->NumberOfThreads; ++index) {
@@ -678,7 +679,7 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
std::string expected_data(kTebSize, static_cast<char>('t' + index));
std::string observed_data(&string_file.string()[memory->Memory.Rva],
memory->Memory.DataSize);
- EXPECT_EQ(expected_data, observed_data);
+ EXPECT_EQ(observed_data, expected_data);
++memory_index;
}
}

Powered by Google App Engine
This is Rietveld 408576698