diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-09 22:44:57 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-09 22:44:57 +0000 |
commit | 6aa9349ef5c1110d9c096945840e6a105e8a8295 (patch) | |
tree | 8afce0e1f3aae77e05105cfbe0d24ea3bdae9106 /chrome/test/ui | |
parent | b61236c6679615af0811d59d130c91397d8c6be7 (diff) | |
download | chromium_src-6aa9349ef5c1110d9c096945840e6a105e8a8295.zip chromium_src-6aa9349ef5c1110d9c096945840e6a105e8a8295.tar.gz chromium_src-6aa9349ef5c1110d9c096945840e6a105e8a8295.tar.bz2 |
Replace chrome_process_filter with chrome_process_util.
- move code only used by tests to chrome/test
- make a better, more portable abstraction
For now, it still only works on Windows. But this is the first step
to porting this part of code.
Patch by phajdan.jr@chromium.org: <http://codereview.chromium.org/54003>
Review URL: http://codereview.chromium.org/67004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/ui')
-rw-r--r-- | chrome/test/ui/ui_test.cc | 29 | ||||
-rw-r--r-- | chrome/test/ui/ui_tests.vcproj | 12 |
2 files changed, 23 insertions, 18 deletions
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index d273175..d30643b2 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -11,6 +11,7 @@ #include "base/command_line.h" #include "base/file_path.h" #include "base/file_util.h" +#include "base/path_service.h" #include "base/platform_thread.h" #include "base/process_util.h" #include "base/scoped_ptr.h" @@ -28,12 +29,12 @@ #include "chrome/test/automation/automation_proxy.h" #include "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/tab_proxy.h" +#include "chrome/test/chrome_process_util.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #if defined(OS_WIN) -// TODO(port): these just need to be ported. -#include "chrome/common/chrome_process_filter.h" +// TODO(port): this just needs to be ported. #include "chrome/test/automation/window_proxy.h" #endif @@ -448,30 +449,22 @@ void UITest::AssertAppNotRunning(const std::wstring& error_message) { #if defined(OS_WIN) ASSERT_EQ(0, GetBrowserProcessCount()) << error_message; #else - // TODO(port): Enable when chrome_process_filter is ported. + // TODO(port): Enable when chrome_process_util is ported. NOTIMPLEMENTED(); #endif } void UITest::CleanupAppProcesses() { #if defined(OS_WIN) - BrowserProcessFilter filter(L""); - - // Make sure that no instances of the browser remain. - const int kExitTimeoutMs = 5000; - const int kExitCode = 1; - base::CleanupProcesses( - chrome::kBrowserProcessExecutableName, kExitTimeoutMs, kExitCode, - &filter); + TerminateAllChromeProcesses(FilePath::FromWStringHack(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_) { + if (!in_process_renderer_) AssertAppNotRunning(L"Unable to quit all browser processes."); - } #else - // TODO(port): depends on BrowserProcessFilter. + // TODO(port): depends on chrome_process_util. NOTIMPLEMENTED(); #endif } @@ -593,13 +586,13 @@ bool UITest::CrashAwareSleep(int time_out_ms) { } #if defined(OS_WIN) -// TODO(port): Port BrowserProcessFilter and sort out one wstring/string issue. +// TODO(port): Port GetRunningChromeProcesses and sort out one w/string issue. /*static*/ int UITest::GetBrowserProcessCount() { - BrowserProcessFilter filter(L""); - return base::GetProcessCount(chrome::kBrowserProcessExecutableName, - &filter); + FilePath data_dir; + PathService::Get(chrome::DIR_USER_DATA, &data_dir); + return GetRunningChromeProcesses(data_dir).size(); } static DictionaryValue* LoadDictionaryValueFromPath(const FilePath& path) { diff --git a/chrome/test/ui/ui_tests.vcproj b/chrome/test/ui/ui_tests.vcproj index 48df244..ea13ea6 100644 --- a/chrome/test/ui/ui_tests.vcproj +++ b/chrome/test/ui/ui_tests.vcproj @@ -174,6 +174,18 @@ > </File> <File + RelativePath="..\chrome_process_util.cc" + > + </File> + <File + RelativePath="..\chrome_process_util.h" + > + </File> + <File + RelativePath="..\chrome_process_util_win.cc" + > + </File> + <File RelativePath="..\testing_browser_process.h" > </File> |