| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/media/webrtc_browsertest_common.h" | 5 #include "chrome/browser/media/webrtc_browsertest_common.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/process/launch.h" | 10 #include "base/process/launch.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 peerconnection_server = peerconnection_server.Append(kServerExecutable); | 86 peerconnection_server = peerconnection_server.Append(kServerExecutable); |
| 87 | 87 |
| 88 if (!base::PathExists(peerconnection_server)) { | 88 if (!base::PathExists(peerconnection_server)) { |
| 89 LOG(ERROR) << "Missing " << kServerExecutable << ". You must build " | 89 LOG(ERROR) << "Missing " << kServerExecutable << ". You must build " |
| 90 "it so it ends up next to the browser test binary."; | 90 "it so it ends up next to the browser test binary."; |
| 91 return false; | 91 return false; |
| 92 } | 92 } |
| 93 | 93 |
| 94 CommandLine command_line(peerconnection_server); | 94 CommandLine command_line(peerconnection_server); |
| 95 command_line.AppendSwitchASCII("port", kDefaultPort); | 95 command_line.AppendSwitchASCII("port", kDefaultPort); |
| 96 LOG(INFO) << "Running " << command_line.GetCommandLineString(); | 96 VLOG(0) << "Running " << command_line.GetCommandLineString(); |
| 97 return base::LaunchProcess(command_line, | 97 return base::LaunchProcess(command_line, |
| 98 base::LaunchOptions(), | 98 base::LaunchOptions(), |
| 99 &server_pid_); | 99 &server_pid_); |
| 100 } | 100 } |
| 101 | 101 |
| 102 bool PeerConnectionServerRunner::Stop() { | 102 bool PeerConnectionServerRunner::Stop() { |
| 103 return base::KillProcess(server_pid_, 0, false); | 103 return base::KillProcess(server_pid_, 0, false); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem() { | 106 void PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem() { |
| 107 if (!base::KillProcesses(kServerExecutable, -1, NULL)) { | 107 if (!base::KillProcesses(kServerExecutable, -1, NULL)) { |
| 108 LOG(ERROR) << "Failed to kill instances of " << kServerExecutable << "."; | 108 LOG(ERROR) << "Failed to kill instances of " << kServerExecutable << "."; |
| 109 return; | 109 return; |
| 110 } | 110 } |
| 111 base::WaitForProcessesToExit(kServerExecutable, | 111 base::WaitForProcessesToExit(kServerExecutable, |
| 112 base::TimeDelta::FromSeconds(5), NULL); | 112 base::TimeDelta::FromSeconds(5), NULL); |
| 113 } | 113 } |
| OLD | NEW |