diff options
-rw-r--r-- | chrome_frame/test/run_all_unittests.cc | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/chrome_frame/test/run_all_unittests.cc b/chrome_frame/test/run_all_unittests.cc index 694c6c0..14add80 100644 --- a/chrome_frame/test/run_all_unittests.cc +++ b/chrome_frame/test/run_all_unittests.cc @@ -31,13 +31,35 @@ void PureCall() { __debugbreak(); } +// This class implements the Run method and registers an exception handler to +// ensure that any ChromeFrame processes like IE, Firefox, etc are terminated +// if there is a crash in the chrome frame test suite. +class ChromeFrameTestSuite : public base::TestSuite { + public: + ChromeFrameTestSuite(int argc, char** argv) + : base::TestSuite(argc, argv) {} + + int Run() { + int ret = -1; + __try { + ret = base::TestSuite::Run(); + } + _except(EXCEPTION_EXECUTE_HANDLER) { + LOG(ERROR) << "ChromeFrame tests crashed"; + chrome_frame_test::KillProcesses(L"iexplore.exe", 0, false); + chrome_frame_test::KillProcesses(L"firefox.exe", 0, false); + } + return ret; + } +}; + int main(int argc, char **argv) { base::EnableTerminationOnHeapCorruption(); base::PlatformThread::SetName("ChromeFrame tests"); _set_purecall_handler(PureCall); - TestSuite test_suite(argc, argv); + ChromeFrameTestSuite test_suite(argc, argv); SetConfigBool(kChromeFrameHeadlessMode, true); SetConfigBool(kChromeFrameAccessibleMode, true); @@ -51,7 +73,6 @@ int main(int argc, char **argv) { } else { // Register paths needed by the ScopedChromeFrameRegistrar. chrome::RegisterPathProvider(); - // This will register the chrome frame in the build directory. It currently // leaves that chrome frame registered once the tests are done. It must be // constructed AFTER the TestSuite is created since TestSuites create THE |