Fixing Windows client unit tests. They were broken in r1034 due to gMock and

gTest upgrade.  While fixing the broken tests I also used the opportunity to add
a few more tests that cover filter and callback execution, and nesting of
exception handlers.

https://breakpad.appspot.com/489002/



git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1073 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ivan.penkov@gmail.com
2012-10-19 18:51:05 +00:00
parent f9a63cb164
commit df8e3973f4
8 changed files with 449 additions and 16 deletions

View File

@@ -35,11 +35,12 @@
#include <string>
#include "../../../breakpad_googletest_includes.h"
#include "../../../../common/windows/string_utils-inl.h"
#include "../crash_generation/crash_generation_server.h"
#include "../handler/exception_handler.h"
#include "../../../../google_breakpad/processor/minidump.h"
#include "breakpad_googletest_includes.h"
#include "client/windows/crash_generation/crash_generation_server.h"
#include "client/windows/handler/exception_handler.h"
#include "client/windows/unittests/exception_handler_test.h"
#include "common/windows/string_utils-inl.h"
#include "google_breakpad/processor/minidump.h"
namespace {
@@ -122,6 +123,10 @@ TEST_F(ExceptionHandlerDeathTest, InProcTest) {
new google_breakpad::ExceptionHandler(
temp_path_, NULL, &MinidumpWrittenCallback, NULL,
google_breakpad::ExceptionHandler::HANDLER_ALL);
// Disable GTest SEH handler
testing::DisableExceptionHandlerInScope disable_exception_handler;
int *i = NULL;
ASSERT_DEATH((*i)++, kSuccessIndicator);
delete exc;
@@ -141,6 +146,10 @@ void ExceptionHandlerDeathTest::DoCrashAccessViolation() {
temp_path_, NULL, NULL, NULL,
google_breakpad::ExceptionHandler::HANDLER_ALL, MiniDumpNormal, kPipeName,
NULL);
// Disable GTest SEH handler
testing::DisableExceptionHandlerInScope disable_exception_handler;
// Although this is executing in the child process of the death test,
// if it's not true we'll still get an error rather than the crash
// being expected.
@@ -252,6 +261,9 @@ TEST_F(ExceptionHandlerDeathTest, InstructionPointerMemory) {
temp_path_, NULL, NULL, NULL,
google_breakpad::ExceptionHandler::HANDLER_ALL);
// Disable GTest SEH handler
testing::DisableExceptionHandlerInScope disable_exception_handler;
// Get some executable memory.
const u_int32_t kMemorySize = 256; // bytes
const int kOffset = kMemorySize / 2;
@@ -334,6 +346,9 @@ TEST_F(ExceptionHandlerDeathTest, InstructionPointerMemoryMinBound) {
temp_path_, NULL, NULL, NULL,
google_breakpad::ExceptionHandler::HANDLER_ALL);
// Disable GTest SEH handler
testing::DisableExceptionHandlerInScope disable_exception_handler;
SYSTEM_INFO sSysInfo; // Useful information about the system
GetSystemInfo(&sSysInfo); // Initialize the structure.
@@ -421,6 +436,9 @@ TEST_F(ExceptionHandlerDeathTest, InstructionPointerMemoryMaxBound) {
temp_path_, NULL, NULL, NULL,
google_breakpad::ExceptionHandler::HANDLER_ALL);
// Disable GTest SEH handler
testing::DisableExceptionHandlerInScope disable_exception_handler;
SYSTEM_INFO sSysInfo; // Useful information about the system
GetSystemInfo(&sSysInfo); // Initialize the structure.