diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-31 23:07:31 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-31 23:07:31 +0000 |
commit | da40d4ea45f0214f29480a37bf665192d694b957 (patch) | |
tree | 6b8802470615dc66986763a41d5bbff8bf0869a8 /chrome/test | |
parent | 198efdff4e02d5ae512288bf3c663986759a1869 (diff) | |
download | chromium_src-da40d4ea45f0214f29480a37bf665192d694b957.zip chromium_src-da40d4ea45f0214f29480a37bf665192d694b957.tar.gz chromium_src-da40d4ea45f0214f29480a37bf665192d694b957.tar.bz2 |
Log more info when we are unable to terminate all Chrome processes.
I'm not sure what's happening, so I'm going to log that.
This should answer the question if the leftover processes are renderers,
or if it's the main browser process, etc.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/180046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24958 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/ui/ui_test.cc | 32 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.h | 1 |
2 files changed, 24 insertions, 9 deletions
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index 1946b78..b59d71f 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -93,6 +93,7 @@ UITest::UITest() wait_for_initial_loads_(true), dom_automation_enabled_(false), process_(0), // NULL on Windows, 0 PID on POSIX. + process_id_(-1), show_window_(false), clear_profile_(true), include_testing_id_(true), @@ -224,8 +225,14 @@ void UITest::CloseBrowserAndServer() { QuitBrowser(); CleanupAppProcesses(); - // Shut down IPC testing interface. - server_.reset(); + // Suppress spammy failures that seem to be occurring when running + // the UI tests in single-process mode. + // TODO(jhughes): figure out why this is necessary at all, and fix it + if (!in_process_renderer_) + AssertAppNotRunning(StringPrintf( + L"Unable to quit all browser processes. Original PID %d", process_id_)); + + server_.reset(); // Shut down IPC testing interface. } static CommandLine* CreatePythonCommandLine() { @@ -340,6 +347,7 @@ void UITest::LaunchBrowser(const CommandLine& arguments, bool clear_profile) { ASSERT_TRUE(LaunchBrowserHelper(arguments, use_existing_browser_, false, &process_)); + process_id_ = base::GetProcId(process_); } bool UITest::LaunchAnotherBrowserBlockUntilClosed(const CommandLine& cmdline) { @@ -396,17 +404,23 @@ void UITest::QuitBrowser() { } void UITest::AssertAppNotRunning(const std::wstring& error_message) { - ASSERT_EQ(0, GetBrowserProcessCount()) << error_message; + std::wstring final_error_message(error_message); + + int process_count = GetBrowserProcessCount(); + if (process_count > 0) { + ChromeProcessList processes = GetRunningChromeProcesses(user_data_dir()); + final_error_message += L" Leftover PIDs: ["; + for (ChromeProcessList::const_iterator it = processes.begin(); + it != processes.end(); ++it) { + final_error_message += StringPrintf(L" %d", *it); + } + final_error_message += L" ]"; + } + ASSERT_EQ(0, process_count) << final_error_message; } void UITest::CleanupAppProcesses() { TerminateAllChromeProcesses(user_data_dir()); - - // Suppress spammy failures that seem to be occurring when running - // the UI tests in single-process mode. - // TODO(jhughes): figure out why this is necessary at all, and fix it - if (!in_process_renderer_) - AssertAppNotRunning(L"Unable to quit all browser processes."); } scoped_refptr<TabProxy> UITest::GetActiveTab(int window_index) { diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h index a0e3cc1..0b0c047 100644 --- a/chrome/test/ui/ui_test.h +++ b/chrome/test/ui/ui_test.h @@ -505,6 +505,7 @@ class UITest : public testing::Test { // test run the dom automation case. std::wstring template_user_data_; // See set_template_user_data(). base::ProcessHandle process_; // Handle to the first Chrome process. + base::ProcessId process_id_; // PID of |process_| (for debugging). FilePath user_data_dir_; // User data directory used for the test static bool in_process_renderer_; // true if we're in single process mode bool show_window_; // Determines if the window is shown or |