aboutsummaryrefslogtreecommitdiff
path: root/src/client/windows/unittests
diff options
context:
space:
mode:
authorcdn@chromium.org <cdn@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-07-10 18:52:07 +0000
committercdn@chromium.org <cdn@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-07-10 18:52:07 +0000
commite05aab7b6bbf2e5ddb80c2f5a1192b97be6f4047 (patch)
treea99cab04e3b4463d50e11eea4a4c2a7cbc70544d /src/client/windows/unittests
parentAdd Android NDK module definition + sample application (diff)
downloadbreakpad-e05aab7b6bbf2e5ddb80c2f5a1192b97be6f4047.tar.xz
Add the capability to include an arbitrary data stream within minidumps
This is supplied via a custom field "custom-data-stream" Review URL: https://breakpad.appspot.com/408002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@984 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/windows/unittests')
-rw-r--r--src/client/windows/unittests/minidump_test.cc29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/client/windows/unittests/minidump_test.cc b/src/client/windows/unittests/minidump_test.cc
index ab7ae3b7..f47ee598 100644
--- a/src/client/windows/unittests/minidump_test.cc
+++ b/src/client/windows/unittests/minidump_test.cc
@@ -31,6 +31,7 @@
#include <objbase.h>
#include <dbghelp.h>
+#include "../common/ipc_protocol.h"
#include "../crash_generation/minidump_generator.h"
#include "dump_analysis.h" // NOLINT
@@ -86,7 +87,8 @@ class MinidumpTest: public testing::Test {
}
}
- bool WriteDump(ULONG flags) {
+ bool WriteDump(ULONG flags, MDRawAssertionInfo* assert,
+ google_breakpad::CustomDataStream* custom_data) {
using google_breakpad::MinidumpGenerator;
// Fake exception is access violation on write to this.
@@ -112,7 +114,8 @@ class MinidumpTest: public testing::Test {
::GetCurrentThreadId(),
::GetCurrentThreadId(),
&ex_ptrs,
- NULL,
+ assert,
+ custom_data,
static_cast<MINIDUMP_TYPE>(flags),
TRUE,
&dump_file_,
@@ -177,7 +180,7 @@ TEST_F(MinidumpTest, Version) {
}
TEST_F(MinidumpTest, Normal) {
- EXPECT_TRUE(WriteDump(MiniDumpNormal));
+ EXPECT_TRUE(WriteDump(MiniDumpNormal, NULL, NULL));
DumpAnalysis mini(dump_file_);
// We expect threads, modules and some memory.
@@ -206,10 +209,13 @@ TEST_F(MinidumpTest, Normal) {
// We expect no off-stack memory in this dump.
EXPECT_FALSE(mini.HasMemory(this));
+
+ // We do not expect a custom data stream.
+ EXPECT_FALSE(mini.HasStream(MD_CUSTOM_DATA_STREAM));
}
TEST_F(MinidumpTest, SmallDump) {
- ASSERT_TRUE(WriteDump(kSmallDumpType));
+ ASSERT_TRUE(WriteDump(kSmallDumpType, NULL, NULL));
DumpAnalysis mini(dump_file_);
EXPECT_TRUE(mini.HasStream(ThreadListStream));
@@ -240,7 +246,7 @@ TEST_F(MinidumpTest, SmallDump) {
}
TEST_F(MinidumpTest, LargerDump) {
- ASSERT_TRUE(WriteDump(kLargerDumpType));
+ ASSERT_TRUE(WriteDump(kLargerDumpType, NULL, NULL));
DumpAnalysis mini(dump_file_);
// The dump should have all of these streams.
@@ -272,7 +278,7 @@ TEST_F(MinidumpTest, LargerDump) {
}
TEST_F(MinidumpTest, FullDump) {
- ASSERT_TRUE(WriteDump(kFullDumpType));
+ ASSERT_TRUE(WriteDump(kFullDumpType, NULL, NULL));
ASSERT_TRUE(dump_file_ != L"");
ASSERT_TRUE(full_dump_file_ != L"");
DumpAnalysis mini(dump_file_);
@@ -329,4 +335,15 @@ TEST_F(MinidumpTest, FullDump) {
EXPECT_FALSE(full.HasStream(TokenStream));
}
+TEST_F(MinidumpTest, CustomData) {
+ google_breakpad::CustomDataStream custom_data;
+ custom_data.size = 1;
+ custom_data.stream[0] = 'A';
+ EXPECT_TRUE(WriteDump(MiniDumpNormal, NULL, &custom_data));
+ DumpAnalysis mini(dump_file_);
+
+ // We expect a custom data stream.
+ EXPECT_TRUE(mini.HasStream(MD_CUSTOM_DATA_STREAM));
+}
+
} // namespace