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

Unified Diff: chrome_frame/crash_reporting/vectored_handler_unittest.cc

Issue 536073: Suppress crash dump generation due to IsBadXXX functions.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 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: chrome_frame/crash_reporting/vectored_handler_unittest.cc
===================================================================
--- chrome_frame/crash_reporting/vectored_handler_unittest.cc (revision 36161)
+++ chrome_frame/crash_reporting/vectored_handler_unittest.cc (working copy)
@@ -6,11 +6,12 @@
#include "base/logging.h"
#include "chrome_frame/crash_reporting/vectored_handler-impl.h"
+#include "chrome_frame/crash_reporting/crash_report.h"
#include "gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
// Class that mocks external call from VectoredHandlerT for testing purposes.
-class EMock : public VEHTraitsBase {
+class EMock : public Win32VEHTraits {
public:
static inline bool WriteDump(EXCEPTION_POINTERS* p) {
g_dump_made = true;
@@ -20,6 +21,7 @@
static inline void* Register(PVECTORED_EXCEPTION_HANDLER func,
const void* module_start,
const void* module_end) {
+ InitializeIgnoredBlocks();
VEHTraitsBase::SetModule(module_start, module_end);
// Return some arbitrary number, expecting to get the same on Unregister()
return reinterpret_cast<void*>(4);
@@ -188,5 +190,25 @@
EXPECT_TRUE(EMock::g_dump_made);
EMock::g_dump_made = false;
+ // Exception, in IsBadStringPtrA, we are on the stack.
+ char* ignore_address = reinterpret_cast<char*>(GetProcAddress(
+ GetModuleHandleA("kernel32.dll"), "IsBadStringPtrA")) + 10;
+ ex.Set(STATUS_ACCESS_VIOLATION, ignore_address + 10, 0);
+ EMock::SetNoSEHFilter();
+ EMock::SetOnStack();
+ EXPECT_EQ(ExceptionContinueSearch, VectoredHandlerMock::VectoredHandler(&ex));
+ EXPECT_EQ(5, VectoredHandlerMock::g_exceptions_seen);
+ EXPECT_FALSE(EMock::g_dump_made);
+ EMock::g_dump_made = false;
+
+ // Exception, in IsBadStringPtrA, we are not in stack.
+ ex.Set(STATUS_ACCESS_VIOLATION, ignore_address + 10, 0);
+ EMock::SetNoSEHFilter();
+ EMock::SetNotOnStack();
+ EXPECT_EQ(ExceptionContinueSearch, VectoredHandlerMock::VectoredHandler(&ex));
+ EXPECT_EQ(6, VectoredHandlerMock::g_exceptions_seen);
+ EXPECT_FALSE(EMock::g_dump_made);
+ EMock::g_dump_made = false;
+
VectoredHandlerMock::Unregister();
}

Powered by Google App Engine
This is Rietveld 408576698