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

Side by Side Diff: net/socket/ssl_test_util.cc

Issue 1822001: Revert "[Third time landing] Python implementation of sync server, for testing." (Closed)
Patch Set: Created 10 years, 7 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
« no previous file with comments | « net/net.gyp ('k') | net/tools/testserver/chromiumsync.py » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/socket/ssl_test_util.h" 5 #include "net/socket/ssl_test_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Do nothing if dir already on path. 82 // Do nothing if dir already on path.
83 83
84 #if defined(OS_WIN) 84 #if defined(OS_WIN)
85 const wchar_t kPythonPath[] = L"PYTHONPATH"; 85 const wchar_t kPythonPath[] = L"PYTHONPATH";
86 // TODO(dkegel): handle longer PYTHONPATH variables 86 // TODO(dkegel): handle longer PYTHONPATH variables
87 wchar_t oldpath[4096]; 87 wchar_t oldpath[4096];
88 if (GetEnvironmentVariable(kPythonPath, oldpath, arraysize(oldpath)) == 0) { 88 if (GetEnvironmentVariable(kPythonPath, oldpath, arraysize(oldpath)) == 0) {
89 SetEnvironmentVariableW(kPythonPath, dir.value().c_str()); 89 SetEnvironmentVariableW(kPythonPath, dir.value().c_str());
90 } else if (!wcsstr(oldpath, dir.value().c_str())) { 90 } else if (!wcsstr(oldpath, dir.value().c_str())) {
91 std::wstring newpath(oldpath); 91 std::wstring newpath(oldpath);
92 newpath.append(L";"); 92 newpath.append(L":");
93 newpath.append(dir.value()); 93 newpath.append(dir.value());
94 SetEnvironmentVariableW(kPythonPath, newpath.c_str()); 94 SetEnvironmentVariableW(kPythonPath, newpath.c_str());
95 } 95 }
96 #elif defined(OS_POSIX) 96 #elif defined(OS_POSIX)
97 const char kPythonPath[] = "PYTHONPATH"; 97 const char kPythonPath[] = "PYTHONPATH";
98 const char* oldpath = getenv(kPythonPath); 98 const char* oldpath = getenv(kPythonPath);
99 // setenv() leaks memory intentionally on Mac 99 // setenv() leaks memory intentionally on Mac
100 if (!oldpath) { 100 if (!oldpath) {
101 setenv(kPythonPath, dir.value().c_str(), 1); 101 setenv(kPythonPath, dir.value().c_str(), 1);
102 } else if (!strstr(oldpath, dir.value().c_str())) { 102 } else if (!strstr(oldpath, dir.value().c_str())) {
103 std::string newpath(oldpath); 103 std::string newpath(oldpath);
104 newpath.append(":"); 104 newpath.append(":");
105 newpath.append(dir.value()); 105 newpath.append(dir.value());
106 setenv(kPythonPath, newpath.c_str(), 1); 106 setenv(kPythonPath, newpath.c_str(), 1);
107 } 107 }
108 #endif 108 #endif
109 } 109 }
110 110
111 } // end namespace 111 } // end namespace
112 112
113 void TestServerLauncher::SetPythonPath() { 113 void TestServerLauncher::SetPythonPath() {
114 FilePath third_party_dir; 114 FilePath third_party_dir;
115 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &third_party_dir)); 115 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &third_party_dir));
116 third_party_dir = third_party_dir.Append(FILE_PATH_LITERAL("third_party")); 116 third_party_dir = third_party_dir.Append(FILE_PATH_LITERAL("third_party"));
117 117
118 AppendToPythonPath(third_party_dir.Append(FILE_PATH_LITERAL("tlslite"))); 118 AppendToPythonPath(third_party_dir.Append(FILE_PATH_LITERAL("tlslite")));
119 AppendToPythonPath(third_party_dir.Append(FILE_PATH_LITERAL("pyftpdlib"))); 119 AppendToPythonPath(third_party_dir.Append(FILE_PATH_LITERAL("pyftpdlib")));
120
121 // Locate the Python code generated by the protocol buffers compiler.
122 FilePath generated_code_dir;
123 CHECK(PathService::Get(base::DIR_EXE, &generated_code_dir));
124 generated_code_dir = generated_code_dir.Append(FILE_PATH_LITERAL("pyproto"));
125 AppendToPythonPath(generated_code_dir);
126 AppendToPythonPath(generated_code_dir.Append(FILE_PATH_LITERAL("sync_pb")));
127 } 120 }
128 121
129 bool TestServerLauncher::Start(Protocol protocol, 122 bool TestServerLauncher::Start(Protocol protocol,
130 const std::string& host_name, int port, 123 const std::string& host_name, int port,
131 const FilePath& document_root, 124 const FilePath& document_root,
132 const FilePath& cert_path, 125 const FilePath& cert_path,
133 const std::wstring& file_root_url) { 126 const std::wstring& file_root_url) {
134 if (!cert_path.value().empty()) { 127 if (!cert_path.value().empty()) {
135 if (!LoadTestRootCert()) 128 if (!LoadTestRootCert())
136 return false; 129 return false;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 "certificate to your trusted roots for this test to work. " 340 "certificate to your trusted roots for this test to work. "
348 "For more info visit:\n" 341 "For more info visit:\n"
349 "http://dev.chromium.org/developers/testing\n"; 342 "http://dev.chromium.org/developers/testing\n";
350 return false; 343 return false;
351 } 344 }
352 #endif 345 #endif
353 return true; 346 return true;
354 } 347 }
355 348
356 } // namespace net 349 } // namespace net
OLDNEW
« no previous file with comments | « net/net.gyp ('k') | net/tools/testserver/chromiumsync.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698