diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-11 06:34:07 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-11 06:34:07 +0000 |
commit | ad5a7b9ac17a6774a06d7d4016807005aece23b5 (patch) | |
tree | e0fd90fd820c8cae560f01c2e89e9422c62fdb0b /chrome_frame | |
parent | 4e22d78c5580474a5535b44a53450e734a078ad6 (diff) | |
download | chromium_src-ad5a7b9ac17a6774a06d7d4016807005aece23b5.zip chromium_src-ad5a7b9ac17a6774a06d7d4016807005aece23b5.tar.gz chromium_src-ad5a7b9ac17a6774a06d7d4016807005aece23b5.tar.bz2 |
Attempt 3 at landing this patch. The previous attempts caused compile failures on the windows builders. The
errors were around using __try __except in code which had C++ objects. The latest attempt works around this
issue by just handling the exception and returning. The processes are terminated by the caller.
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/6170006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71015 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/test/run_all_unittests.cc | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/chrome_frame/test/run_all_unittests.cc b/chrome_frame/test/run_all_unittests.cc index 694c6c0..8736e66 100644 --- a/chrome_frame/test/run_all_unittests.cc +++ b/chrome_frame/test/run_all_unittests.cc @@ -31,13 +31,36 @@ 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() { + // Register a stack based exception handler to catch any exceptions which + // occur in the course of the test. + int ret = -1; + __try { + ret = base::TestSuite::Run(); + } + + _except(EXCEPTION_EXECUTE_HANDLER) { + ret = -1; + } + 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); @@ -67,6 +90,12 @@ int main(int argc, char **argv) { ret = test_suite.Run(); } + if (ret == -1) { + LOG(ERROR) << "ChromeFrame tests crashed"; + chrome_frame_test::KillProcesses(L"iexplore.exe", 0, false); + chrome_frame_test::KillProcesses(L"firefox.exe", 0, false); + } + DeleteConfigValue(kChromeFrameHeadlessMode); DeleteConfigValue(kChromeFrameAccessibleMode); |