summaryrefslogtreecommitdiffstats
path: root/chrome/test/chrome_process_util_mac.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-13 14:37:38 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-13 14:37:38 +0000
commit4b59cf24ca1128e5b3f3b4fa8b585575d44222f7 (patch)
tree063ccb2187e2285260b309e284b2f2170b0240e4 /chrome/test/chrome_process_util_mac.cc
parentfd7bdcc89b6483ebbfc4eaca6a7b0ba1fe1aca1b (diff)
downloadchromium_src-4b59cf24ca1128e5b3f3b4fa8b585575d44222f7.zip
chromium_src-4b59cf24ca1128e5b3f3b4fa8b585575d44222f7.tar.gz
chromium_src-4b59cf24ca1128e5b3f3b4fa8b585575d44222f7.tar.bz2
Make running chrome process detection in ui tests more reliable.
Also drops fragile code. TEST=Covered by ui_tests. BUG=10840 Review URL: http://codereview.chromium.org/545006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/chrome_process_util_mac.cc')
-rw-r--r--chrome/test/chrome_process_util_mac.cc45
1 files changed, 0 insertions, 45 deletions
diff --git a/chrome/test/chrome_process_util_mac.cc b/chrome/test/chrome_process_util_mac.cc
index 4c60ad3..d920735 100644
--- a/chrome/test/chrome_process_util_mac.cc
+++ b/chrome/test/chrome_process_util_mac.cc
@@ -11,51 +11,6 @@
#include "base/process_util.h"
#include "base/string_util.h"
-// Yes, this is impossibly lame. This horrible hack is Good Enough, though,
-// because it's not used in production code, but just for testing.
-//
-// We could make this better by creating a system through which all instances of
-// Chromium can communicate. ProcessSingleton does that for Windows and Linux,
-// but the Mac doesn't implement it as its system services handle it. It's not
-// worth implementing just for this.
-//
-// We could do something similar to what Linux does, and use |fuser| to find a
-// file that the app ordinarily opens within the data dir. However, fuser is
-// broken on Leopard, and does not detect files that lsof shows are open.
-//
-// What's going on here is that during ui_tests, the Chromium application is
-// launched using the --user-data-dir command line option. By examining the
-// output of ps, we can find the appropriately-launched Chromium process. Note
-// that this _does_ work for paths with spaces. The command line that ps gives
-// is just the argv separated with spaces. There's no escaping spaces as a shell
-// would do, so a straight string comparison will work just fine.
-//
-// TODO(avi):see if there is a better way
-
-base::ProcessId ChromeBrowserProcessId(const FilePath& data_dir) {
- std::vector<std::string> argv;
- argv.push_back("ps");
- argv.push_back("-xw");
-
- std::string ps_output;
- if (!base::GetAppOutput(CommandLine(argv), &ps_output))
- return -1;
-
- std::vector<std::string> lines;
- SplitString(ps_output, '\n', &lines);
-
- for (size_t i=0; i<lines.size(); ++i) {
- const std::string& line = lines[i];
- if (line.find(data_dir.value()) != std::string::npos &&
- line.find("type=renderer") == std::string::npos) {
- int pid = StringToInt(line); // pid is at beginning of line
- return pid==0 ? -1 : pid;
- }
- }
-
- return -1;
-}
-
MacChromeProcessInfoList GetRunningMacProcessInfo(
const ChromeProcessList &process_list) {
MacChromeProcessInfoList result;