Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: net/test/test_server_posix.cc

Issue 9545019: Add "run_testserver --sync-test" for easy chromiumsync_test.py launching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: retreat to run_testserver Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/test_server.h" 5 #include "net/test/test_server.h"
6 6
7 #include <poll.h> 7 #include <poll.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/process_util.h" 14 #include "base/process_util.h"
15 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/test/test_timeouts.h" 17 #include "base/test/test_timeouts.h"
18 #include "net/test/python_utils.h"
18 19
19 namespace { 20 namespace {
20 21
21 // Helper class used to detect and kill orphaned python test server processes. 22 // Helper class used to detect and kill orphaned python test server processes.
22 // Checks if the command line of a process contains |path_string| (the path 23 // Checks if the command line of a process contains |path_string| (the path
23 // 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
24 // 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
25 // it is an orphaned process). 26 // it is an orphaned process).
26 class OrphanedTestServerFilter : public base::ProcessFilter { 27 class OrphanedTestServerFilter : public base::ProcessFilter {
27 public: 28 public:
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 bytes_read += num_bytes; 88 bytes_read += num_bytes;
88 } 89 }
89 return true; 90 return true;
90 } 91 }
91 92
92 } // namespace 93 } // namespace
93 94
94 namespace net { 95 namespace net {
95 96
96 bool TestServer::LaunchPython(const FilePath& testserver_path) { 97 bool TestServer::LaunchPython(const FilePath& testserver_path) {
98 VLOG(1) << "LaunchPython called with PYTHONPATH = " <<
Paweł Hajdan Jr. 2012/03/13 17:15:23 Is this needed?
tim (not reviewing) 2012/03/15 00:41:40 Fred asked for this in review, and I think it's us
99 getenv(kPythonPathEnv);
97 CommandLine python_command(FilePath(FILE_PATH_LITERAL("python"))); 100 CommandLine python_command(FilePath(FILE_PATH_LITERAL("python")));
98 python_command.AppendArgPath(testserver_path); 101 python_command.AppendArgPath(testserver_path);
99 if (!AddCommandLineArguments(&python_command)) 102 if (!AddCommandLineArguments(&python_command))
100 return false; 103 return false;
101 104
102 int pipefd[2]; 105 int pipefd[2];
103 if (pipe(pipefd) != 0) { 106 if (pipe(pipefd) != 0) {
104 PLOG(ERROR) << "Could not create pipe."; 107 PLOG(ERROR) << "Could not create pipe.";
105 return false; 108 return false;
106 } 109 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 159
157 if (!ParseServerData(server_data)) { 160 if (!ParseServerData(server_data)) {
158 LOG(ERROR) << "Could not parse server_data: " << server_data; 161 LOG(ERROR) << "Could not parse server_data: " << server_data;
159 return false; 162 return false;
160 } 163 }
161 164
162 return true; 165 return true;
163 } 166 }
164 167
165 } // namespace net 168 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698