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

Unified Diff: minidump/minidump_system_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_string_writer_test.cc ('k') | minidump/minidump_thread_writer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: minidump/minidump_system_info_writer_test.cc
diff --git a/minidump/minidump_system_info_writer_test.cc b/minidump/minidump_system_info_writer_test.cc
index 9c45416a2193c1c49e411ec74fc561906a79e51a..28c91df3ac17e3bd7e59b60997b480f2b59eba13 100644
--- a/minidump/minidump_system_info_writer_test.cc
+++ b/minidump/minidump_system_info_writer_test.cc
@@ -22,6 +22,7 @@
#include "gtest/gtest.h"
#include "minidump/minidump_file_writer.h"
#include "minidump/test/minidump_file_writer_test_util.h"
+#include "minidump/test/minidump_string_writer_test_util.h"
#include "util/file/string_file_writer.h"
namespace crashpad {
@@ -48,27 +49,23 @@ void GetSystemInfoStream(const std::string& file_contents,
ASSERT_EQ(kFileSize, file_contents.size());
+ 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(kMinidumpStreamTypeSystemInfo, directory->StreamType);
- ASSERT_EQ(sizeof(MINIDUMP_SYSTEM_INFO), directory->Location.DataSize);
- ASSERT_EQ(kSystemInfoStreamOffset, directory->Location.Rva);
+ ASSERT_EQ(kMinidumpStreamTypeSystemInfo, directory[0].StreamType);
+ ASSERT_EQ(sizeof(MINIDUMP_SYSTEM_INFO), directory[0].Location.DataSize);
+ ASSERT_EQ(kSystemInfoStreamOffset, directory[0].Location.Rva);
*system_info = reinterpret_cast<const MINIDUMP_SYSTEM_INFO*>(
&file_contents[kSystemInfoStreamOffset]);
ASSERT_EQ(kCSDVersionOffset, (*system_info)->CSDVersionRva);
- *csd_version = reinterpret_cast<const MINIDUMP_STRING*>(
- &file_contents[kCSDVersionOffset]);
-
+ *csd_version =
+ MinidumpStringAtRVA(file_contents, (*system_info)->CSDVersionRva);
ASSERT_EQ(kCSDVersionBytes, (*csd_version)->Length);
}
« no previous file with comments | « minidump/minidump_string_writer_test.cc ('k') | minidump/minidump_thread_writer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698