OLD | NEW |
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 <windows.h> | 7 #include <windows.h> |
8 #include <wincrypt.h> | 8 #include <wincrypt.h> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 LOG(ERROR) << "Could not AssignProcessToObject."; | 67 LOG(ERROR) << "Could not AssignProcessToObject."; |
68 return false; | 68 return false; |
69 } | 69 } |
70 } | 70 } |
71 return true; | 71 return true; |
72 } | 72 } |
73 | 73 |
74 } // namespace | 74 } // namespace |
75 | 75 |
76 namespace net { | 76 namespace net { |
77 | |
78 // static | |
79 void TestServer::AppendToPythonPath(const FilePath& dir) { | |
80 const wchar_t kPythonPath[] = L"PYTHONPATH"; | |
81 // TODO(dkegel): handle longer PYTHONPATH variables | |
82 wchar_t oldpath[4096]; | |
83 if (GetEnvironmentVariable(kPythonPath, oldpath, arraysize(oldpath)) == 0) { | |
84 SetEnvironmentVariableW(kPythonPath, dir.value().c_str()); | |
85 } else if (!wcsstr(oldpath, dir.value().c_str())) { | |
86 std::wstring newpath(oldpath); | |
87 newpath.append(L";"); | |
88 newpath.append(dir.value()); | |
89 SetEnvironmentVariableW(kPythonPath, newpath.c_str()); | |
90 } | |
91 } | |
92 | |
93 bool TestServer::LaunchPython(const FilePath& testserver_path) { | 77 bool TestServer::LaunchPython(const FilePath& testserver_path) { |
94 FilePath python_exe; | 78 FilePath python_exe; |
95 if (!PathService::Get(base::DIR_SOURCE_ROOT, &python_exe)) | 79 if (!PathService::Get(base::DIR_SOURCE_ROOT, &python_exe)) |
96 return false; | 80 return false; |
97 python_exe = python_exe | 81 python_exe = python_exe |
98 .Append(FILE_PATH_LITERAL("third_party")) | 82 .Append(FILE_PATH_LITERAL("third_party")) |
99 .Append(FILE_PATH_LITERAL("python_24")) | 83 .Append(FILE_PATH_LITERAL("python_24")) |
100 .Append(FILE_PATH_LITERAL("python.exe")); | 84 .Append(FILE_PATH_LITERAL("python.exe")); |
101 | 85 |
102 std::wstring command_line = | 86 std::wstring command_line = |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 "certificate to your trusted roots for this test to work. " | 140 "certificate to your trusted roots for this test to work. " |
157 "For more info visit:\n" | 141 "For more info visit:\n" |
158 "http://dev.chromium.org/developers/testing\n"; | 142 "http://dev.chromium.org/developers/testing\n"; |
159 return false; | 143 return false; |
160 } | 144 } |
161 | 145 |
162 return true; | 146 return true; |
163 } | 147 } |
164 | 148 |
165 } // namespace net | 149 } // namespace net |
OLD | NEW |