diff options
author | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-07 21:20:19 +0000 |
---|---|---|
committer | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-07 21:20:19 +0000 |
commit | 0b5a2f86ee50eaa88d090c9f0e0a81b30e650b39 (patch) | |
tree | c28c9683dcaf72e73b1a0557e2e80851dcc9ccbe /chrome_frame/test | |
parent | dcf3c878a87776d20f021d9bbd2b4f3b09fbb44e (diff) | |
download | chromium_src-0b5a2f86ee50eaa88d090c9f0e0a81b30e650b39.zip chromium_src-0b5a2f86ee50eaa88d090c9f0e0a81b30e650b39.tar.gz chromium_src-0b5a2f86ee50eaa88d090c9f0e0a81b30e650b39.tar.bz2 |
Kill all browser instances at test start up in addition to at tear down which should improve test reliability.
Make running the Chrome Frame integration tests slightly less onerous by not killing non-ChromeFrame instances of Chrome.
BUG=All chrome.exe instances would die when running these tests, which made them annoying to run.
TEST=Only Chrome Frame instances of Chrome will be killed when running the integration tests.
Review URL: http://codereview.chromium.org/467036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test')
-rw-r--r-- | chrome_frame/test/chrome_frame_unittests.cc | 27 | ||||
-rw-r--r-- | chrome_frame/test/chrome_frame_unittests.h | 3 |
2 files changed, 22 insertions, 8 deletions
diff --git a/chrome_frame/test/chrome_frame_unittests.cc b/chrome_frame/test/chrome_frame_unittests.cc index fece220..4d62e74 100644 --- a/chrome_frame/test/chrome_frame_unittests.cc +++ b/chrome_frame/test/chrome_frame_unittests.cc @@ -24,6 +24,7 @@ #include "chrome_frame/crash_reporting/vectored_handler-impl.h" #include "chrome_frame/test/chrome_frame_test_utils.h" #include "chrome_frame/test_utils.h" +#include "chrome/common/chrome_switches.h" #include "chrome/installer/util/install_util.h" #include "chrome/installer/util/helper.h" @@ -78,7 +79,24 @@ _ATL_FUNC_INFO WebBrowserEventSink::kNewWindow3Info = { _ATL_FUNC_INFO WebBrowserEventSink::kVoidMethodInfo = { CC_STDCALL, VT_EMPTY, 0, {NULL}}; +void ChromeFrameTestWithWebServer::CloseAllBrowsers() { + // Web browsers tend to relaunch themselves in other processes, meaning the + // KillProcess stuff above might not have actually cleaned up all our browser + // instances, so make really sure browsers are dead. + base::KillProcesses(chrome_frame_test::kIEImageName, 0, NULL); + base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL); + base::KillProcesses(chrome_frame_test::kFirefoxImageName, 0, NULL); + base::KillProcesses(chrome_frame_test::kSafariImageName, 0, NULL); + + // Endeavour to only kill off Chrome Frame derived Chrome processes. + KillAllNamedProcessesWithArgument(chrome_frame_test::kChromeImageName, + UTF8ToWide(switches::kChromeFrame)); +} + void ChromeFrameTestWithWebServer::SetUp() { + // Make sure our playground is clean before we start. + CloseAllBrowsers(); + server_.SetUp(); results_dir_ = server_.GetDataDir(); file_util::AppendToPath(&results_dir_, L"dump"); @@ -87,14 +105,7 @@ void ChromeFrameTestWithWebServer::SetUp() { void ChromeFrameTestWithWebServer::TearDown() { CloseBrowser(); - // Web browsers tend to relaunch themselves in other processes, meaning the - // KillProcess stuff above might not have actually cleaned up all our browser - // instances, so make really sure browsers are dead. - base::KillProcesses(chrome_frame_test::kIEImageName, 0, NULL); - base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL); - base::KillProcesses(chrome_frame_test::kFirefoxImageName, 0, NULL); - base::KillProcesses(chrome_frame_test::kSafariImageName, 0, NULL); - base::KillProcesses(chrome_frame_test::kChromeImageName, 0, NULL); + CloseAllBrowsers(); server_.TearDown(); } diff --git a/chrome_frame/test/chrome_frame_unittests.h b/chrome_frame/test/chrome_frame_unittests.h index c39058b..b009faf 100644 --- a/chrome_frame/test/chrome_frame_unittests.h +++ b/chrome_frame/test/chrome_frame_unittests.h @@ -63,6 +63,9 @@ class ChromeFrameTestWithWebServer: public testing::Test { void VersionTest(BrowserKind browser, const wchar_t* page, const wchar_t* result_file_to_check); + // Closes all browsers in preparation for a test and during cleanup. + void CloseAllBrowsers(); + void CloseBrowser(); // Ensures (well, at least tries to ensure) that the browser window has focus. |