diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-13 14:37:38 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-13 14:37:38 +0000 |
commit | 4b59cf24ca1128e5b3f3b4fa8b585575d44222f7 (patch) | |
tree | 063ccb2187e2285260b309e284b2f2170b0240e4 /chrome/test/chrome_process_util_linux.cc | |
parent | fd7bdcc89b6483ebbfc4eaca6a7b0ba1fe1aca1b (diff) | |
download | chromium_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_linux.cc')
-rw-r--r-- | chrome/test/chrome_process_util_linux.cc | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/chrome/test/chrome_process_util_linux.cc b/chrome/test/chrome_process_util_linux.cc deleted file mode 100644 index 8905c8c..0000000 --- a/chrome/test/chrome_process_util_linux.cc +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/test/chrome_process_util.h" - -#include <stdio.h> - -#include <string> -#include <vector> - -#include "base/command_line.h" -#include "base/logging.h" -#include "base/process_util.h" -#include "base/string_util.h" -#include "chrome/common/chrome_constants.h" - -base::ProcessId ChromeBrowserProcessId(const FilePath& data_dir) { - FilePath socket_name = data_dir.Append(chrome::kSingletonSocketFilename); - - std::vector<std::string> argv; - argv.push_back("fuser"); - argv.push_back(socket_name.value()); - - std::string fuser_output; - if (!base::GetAppOutput(CommandLine(argv), &fuser_output)) - return -1; - - std::string trimmed_output; - TrimWhitespaceASCII(fuser_output, TRIM_ALL, &trimmed_output); - - if (trimmed_output.find(' ') != std::string::npos) { - LOG(FATAL) << "Expected exactly 1 process to have socket open: " << - fuser_output; - return -1; - } - - int pid; - if (!StringToInt(trimmed_output, &pid)) { - LOG(FATAL) << "Unexpected fuser output: " << fuser_output; - return -1; - } - return pid; -} |