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

@@ -27,6 +27,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "client/windows/unittests/exception_handler_test.h"
#include <windows.h>
#include <dbghelp.h>
#include <strsafe.h>
@@ -35,12 +37,25 @@
#include <string>
#include "../../../breakpad_googletest_includes.h"
#include "../../../../common/windows/string_utils-inl.h"
#include "../../../../google_breakpad/processor/minidump.h"
#include "../crash_generation/crash_generation_server.h"
#include "../handler/exception_handler.h"
#include "dump_analysis.h" // NOLINT
#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/dump_analysis.h" // NOLINT
#include "common/windows/string_utils-inl.h"
#include "google_breakpad/processor/minidump.h"
namespace testing {
DisableExceptionHandlerInScope::DisableExceptionHandlerInScope() {
catch_exceptions_ = GTEST_FLAG(catch_exceptions);
GTEST_FLAG(catch_exceptions) = false;
}
DisableExceptionHandlerInScope::~DisableExceptionHandlerInScope() {
GTEST_FLAG(catch_exceptions) = catch_exceptions_;
}
} // namespace testing
namespace {
@@ -361,6 +376,10 @@ TEST_F(ExceptionHandlerTest, WriteMinidumpTest) {
DumpCallback,
NULL,
ExceptionHandler::HANDLER_ALL);
// Disable GTest SEH handler
testing::DisableExceptionHandlerInScope disable_exception_handler;
ASSERT_TRUE(handler.WriteMinidump());
ASSERT_FALSE(dump_file.empty());
@@ -396,6 +415,9 @@ TEST_F(ExceptionHandlerTest, AdditionalMemory) {
NULL,
ExceptionHandler::HANDLER_ALL);
// Disable GTest SEH handler
testing::DisableExceptionHandlerInScope disable_exception_handler;
// Add the memory region to the list of memory to be included.
handler.RegisterAppMemory(memory, kMemorySize);
ASSERT_TRUE(handler.WriteMinidump());
@@ -447,6 +469,9 @@ TEST_F(ExceptionHandlerTest, AdditionalMemoryRemove) {
NULL,
ExceptionHandler::HANDLER_ALL);
// Disable GTest SEH handler
testing::DisableExceptionHandlerInScope disable_exception_handler;
// Add the memory region to the list of memory to be included.
handler.RegisterAppMemory(memory, kMemorySize);