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

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

Issue 3366026: Add python_utils to append to python path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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/test_server.cc ('k') | net/test/test_server_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 10
11 namespace net { 11 namespace net {
12
13 // static
14 void TestServer::AppendToPythonPath(const FilePath& dir) {
15 const char kPythonPath[] = "PYTHONPATH";
16 const char* oldpath = getenv(kPythonPath);
17 // setenv() leaks memory intentionally on Mac
18 if (!oldpath) {
19 setenv(kPythonPath, dir.value().c_str(), 1);
20 } else if (!strstr(oldpath, dir.value().c_str())) {
21 std::string newpath(oldpath);
22 newpath.append(":");
23 newpath.append(dir.value());
24 setenv(kPythonPath, newpath.c_str(), 1);
25 }
26 }
27
28 bool TestServer::LaunchPython(const FilePath& testserver_path) { 12 bool TestServer::LaunchPython(const FilePath& testserver_path) {
29 std::vector<std::string> command_line; 13 std::vector<std::string> command_line;
30 command_line.push_back("python"); 14 command_line.push_back("python");
31 command_line.push_back(testserver_path.value()); 15 command_line.push_back(testserver_path.value());
32 command_line.push_back("--port=" + base::IntToString(host_port_pair_.port())); 16 command_line.push_back("--port=" + base::IntToString(host_port_pair_.port()));
33 command_line.push_back("--data-dir=" + document_root_.value()); 17 command_line.push_back("--data-dir=" + document_root_.value());
34 18
35 if (type_ == TYPE_FTP) 19 if (type_ == TYPE_FTP)
36 command_line.push_back("-f"); 20 command_line.push_back("-f");
37 21
(...skipping 17 matching lines...) Expand all
55 } 39 }
56 40
57 return true; 41 return true;
58 } 42 }
59 43
60 bool TestServer::CheckCATrusted() { 44 bool TestServer::CheckCATrusted() {
61 return true; 45 return true;
62 } 46 }
63 47
64 } // namespace net 48 } // namespace net
OLDNEW
« no previous file with comments | « net/test/test_server.cc ('k') | net/test/test_server_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698