| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/test/local_test_server.h" | 5 #include "net/test/local_test_server.h" |
| 6 | 6 |
| 7 #include <poll.h> | 7 #include <poll.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // from which the test server was launched) and |port_string| (the port used by | 24 // from which the test server was launched) and |port_string| (the port used by |
| 25 // the test server), and if the parent pid of the process is 1 (indicating that | 25 // the test server), and if the parent pid of the process is 1 (indicating that |
| 26 // it is an orphaned process). | 26 // it is an orphaned process). |
| 27 class OrphanedTestServerFilter : public base::ProcessFilter { | 27 class OrphanedTestServerFilter : public base::ProcessFilter { |
| 28 public: | 28 public: |
| 29 OrphanedTestServerFilter( | 29 OrphanedTestServerFilter( |
| 30 const std::string& path_string, const std::string& port_string) | 30 const std::string& path_string, const std::string& port_string) |
| 31 : path_string_(path_string), | 31 : path_string_(path_string), |
| 32 port_string_(port_string) {} | 32 port_string_(port_string) {} |
| 33 | 33 |
| 34 virtual bool Includes(const base::ProcessEntry& entry) const { | 34 virtual bool Includes(const base::ProcessEntry& entry) const OVERRIDE { |
| 35 if (entry.parent_pid() != 1) | 35 if (entry.parent_pid() != 1) |
| 36 return false; | 36 return false; |
| 37 bool found_path_string = false; | 37 bool found_path_string = false; |
| 38 bool found_port_string = false; | 38 bool found_port_string = false; |
| 39 for (std::vector<std::string>::const_iterator it = | 39 for (std::vector<std::string>::const_iterator it = |
| 40 entry.cmd_line_args().begin(); | 40 entry.cmd_line_args().begin(); |
| 41 it != entry.cmd_line_args().end(); | 41 it != entry.cmd_line_args().end(); |
| 42 ++it) { | 42 ++it) { |
| 43 if (it->find(path_string_) != std::string::npos) | 43 if (it->find(path_string_) != std::string::npos) |
| 44 found_path_string = true; | 44 found_path_string = true; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 if (!ParseServerData(server_data)) { | 162 if (!ParseServerData(server_data)) { |
| 163 LOG(ERROR) << "Could not parse server_data: " << server_data; | 163 LOG(ERROR) << "Could not parse server_data: " << server_data; |
| 164 return false; | 164 return false; |
| 165 } | 165 } |
| 166 | 166 |
| 167 return true; | 167 return true; |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace net | 170 } // namespace net |
| OLD | NEW |