aboutsummaryrefslogtreecommitdiff
path: root/src/client/windows/unittests/exception_handler_test.cc
diff options
context:
space:
mode:
authorivan.penkov@gmail.com <ivan.penkov@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-10-19 18:51:05 +0000
committerivan.penkov@gmail.com <ivan.penkov@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-10-19 18:51:05 +0000
commitdf8e3973f49e9320464f20b62953998736fe9b9e (patch)
tree308dbe8b4ea5f18a62c6195b4a89c70d89ba524a /src/client/windows/unittests/exception_handler_test.cc
parentFix some compiler errors in exception_handler_unittest by casting like crazy (diff)
downloadbreakpad-df8e3973f49e9320464f20b62953998736fe9b9e.tar.xz
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
Diffstat (limited to 'src/client/windows/unittests/exception_handler_test.cc')
-rw-r--r--src/client/windows/unittests/exception_handler_test.cc37
1 files changed, 31 insertions, 6 deletions
diff --git a/src/client/windows/unittests/exception_handler_test.cc b/src/client/windows/unittests/exception_handler_test.cc
index 9851998e..be9397b8 100644
--- a/src/client/windows/unittests/exception_handler_test.cc
+++ b/src/client/windows/unittests/exception_handler_test.cc
@@ -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);