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

Side by Side Diff: net/test/local_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: revert a few files 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
« no previous file with comments | « net/test/local_test_server.cc ('k') | net/tools/testserver/run_testserver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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 LocalTestServer::LaunchPython(const FilePath& testserver_path) { 97 bool LocalTestServer::LaunchPython(const FilePath& testserver_path) {
98 // Log is useful in the event you want to run a nearby script (e.g. a test) in
99 // the same environment as the TestServer.
100 VLOG(1) << "LaunchPython called with PYTHONPATH = " <<
101 getenv(kPythonPathEnv);
97 CommandLine python_command(FilePath(FILE_PATH_LITERAL("python"))); 102 CommandLine python_command(FilePath(FILE_PATH_LITERAL("python")));
103
98 python_command.AppendArgPath(testserver_path); 104 python_command.AppendArgPath(testserver_path);
99 if (!AddCommandLineArguments(&python_command)) 105 if (!AddCommandLineArguments(&python_command))
100 return false; 106 return false;
101 107
102 int pipefd[2]; 108 int pipefd[2];
103 if (pipe(pipefd) != 0) { 109 if (pipe(pipefd) != 0) {
104 PLOG(ERROR) << "Could not create pipe."; 110 PLOG(ERROR) << "Could not create pipe.";
105 return false; 111 return false;
106 } 112 }
107 113
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 162
157 if (!ParseServerData(server_data)) { 163 if (!ParseServerData(server_data)) {
158 LOG(ERROR) << "Could not parse server_data: " << server_data; 164 LOG(ERROR) << "Could not parse server_data: " << server_data;
159 return false; 165 return false;
160 } 166 }
161 167
162 return true; 168 return true;
163 } 169 }
164 170
165 } // namespace net 171 } // namespace net
OLDNEW
« no previous file with comments | « net/test/local_test_server.cc ('k') | net/tools/testserver/run_testserver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698