diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-11 01:41:24 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-11 01:41:24 +0000 |
commit | 1c54823d55bfe39a4caa679f5f867b0c96368e05 (patch) | |
tree | 16f9e58771d08c442ea1a85130d56924475a9428 /chrome_frame/test | |
parent | 2fe2a5fa9cb4e20527d49f94c4a1bf6d6ad7f20c (diff) | |
download | chromium_src-1c54823d55bfe39a4caa679f5f867b0c96368e05.zip chromium_src-1c54823d55bfe39a4caa679f5f867b0c96368e05.tar.gz chromium_src-1c54823d55bfe39a4caa679f5f867b0c96368e05.tar.bz2 |
Relanding this patch.
Prevent extract build failures on the ChromeFrame builders caused when the chrome frame
tests executable crashes while running a test by register an exception handler
and terminating the relevant processes.
BUG=none
TEST=none
TBR=amit
Review URL: http://codereview.chromium.org/6130006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70981 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test')
-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 |