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

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

Issue 201083: Cache login identity for NewFTP transactions. (Closed)
Patch Set: better Created 11 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <string> 5 #include <string>
6 #include <algorithm> 6 #include <algorithm>
7 7
8 #include "net/socket/ssl_test_util.h" 8 #include "net/socket/ssl_test_util.h"
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 const char TestServerLauncher::kHostName[] = "127.0.0.1"; 131 const char TestServerLauncher::kHostName[] = "127.0.0.1";
132 const char TestServerLauncher::kMismatchedHostName[] = "localhost"; 132 const char TestServerLauncher::kMismatchedHostName[] = "localhost";
133 const int TestServerLauncher::kOKHTTPSPort = 9443; 133 const int TestServerLauncher::kOKHTTPSPort = 9443;
134 const int TestServerLauncher::kBadHTTPSPort = 9666; 134 const int TestServerLauncher::kBadHTTPSPort = 9666;
135 135
136 // The issuer name of the cert that should be trusted for the test to work. 136 // The issuer name of the cert that should be trusted for the test to work.
137 const wchar_t TestServerLauncher::kCertIssuerName[] = L"Test CA"; 137 const wchar_t TestServerLauncher::kCertIssuerName[] = L"Test CA";
138 138
139 TestServerLauncher::TestServerLauncher() : process_handle_(NULL), 139 TestServerLauncher::TestServerLauncher() : process_handle_(NULL),
140 forking_(false), 140 forking_(false),
141 ftp_enable_anonymous_(false),
141 connection_attempts_(10), 142 connection_attempts_(10),
142 connection_timeout_(1000) 143 connection_timeout_(1000)
143 #if defined(OS_LINUX) 144 #if defined(OS_LINUX)
144 , cert_(NULL) 145 , cert_(NULL)
145 #endif 146 #endif
146 { 147 {
147 InitCertPath(); 148 InitCertPath();
148 } 149 }
149 150
150 TestServerLauncher::TestServerLauncher(int connection_attempts, 151 TestServerLauncher::TestServerLauncher(int connection_attempts,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 python_runtime_ = python_runtime_ 248 python_runtime_ = python_runtime_
248 .Append(FILE_PATH_LITERAL("third_party")) 249 .Append(FILE_PATH_LITERAL("third_party"))
249 .Append(FILE_PATH_LITERAL("python_24")) 250 .Append(FILE_PATH_LITERAL("python_24"))
250 .Append(FILE_PATH_LITERAL("python.exe")); 251 .Append(FILE_PATH_LITERAL("python.exe"));
251 252
252 std::wstring command_line = 253 std::wstring command_line =
253 L"\"" + python_runtime_.ToWStringHack() + L"\" " + 254 L"\"" + python_runtime_.ToWStringHack() + L"\" " +
254 L"\"" + testserver_path.ToWStringHack() + 255 L"\"" + testserver_path.ToWStringHack() +
255 L"\" --port=" + UTF8ToWide(port_str) + 256 L"\" --port=" + UTF8ToWide(port_str) +
256 L" --data-dir=\"" + document_root_dir_.ToWStringHack() + L"\""; 257 L" --data-dir=\"" + document_root_dir_.ToWStringHack() + L"\"";
257 if (protocol == ProtoFTP) 258 if (protocol == ProtoFTP) {
258 command_line.append(L" -f"); 259 command_line.append(L" --ftp");
260 if (ftp_enable_anonymous_)
261 command_line.append(L" --ftp-enable-anonymous");
262 }
259 if (!cert_path.value().empty()) { 263 if (!cert_path.value().empty()) {
260 command_line.append(L" --https=\""); 264 command_line.append(L" --https=\"");
261 command_line.append(cert_path.ToWStringHack()); 265 command_line.append(cert_path.ToWStringHack());
262 command_line.append(L"\""); 266 command_line.append(L"\"");
263 } 267 }
264 if (!file_root_url.empty()) { 268 if (!file_root_url.empty()) {
265 command_line.append(L" --file-root-url=\""); 269 command_line.append(L" --file-root-url=\"");
266 command_line.append(file_root_url); 270 command_line.append(file_root_url);
267 command_line.append(L"\""); 271 command_line.append(L"\"");
268 } 272 }
269 // Deliberately do not pass the --forking flag. It breaks the tests 273 // Deliberately do not pass the --forking flag. It breaks the tests
270 // on Windows. 274 // on Windows.
271 275
272 if (!base::LaunchApp(command_line, false, true, &process_handle_)) { 276 if (!base::LaunchApp(command_line, false, true, &process_handle_)) {
273 LOG(ERROR) << "Failed to launch " << command_line; 277 LOG(ERROR) << "Failed to launch " << command_line;
274 return false; 278 return false;
275 } 279 }
276 #elif defined(OS_POSIX) 280 #elif defined(OS_POSIX)
277 std::vector<std::string> command_line; 281 std::vector<std::string> command_line;
278 command_line.push_back("python"); 282 command_line.push_back("python");
279 command_line.push_back(WideToUTF8(testserver_path.ToWStringHack())); 283 command_line.push_back(WideToUTF8(testserver_path.ToWStringHack()));
280 command_line.push_back("--port=" + port_str); 284 command_line.push_back("--port=" + port_str);
281 command_line.push_back("--data-dir=" + 285 command_line.push_back("--data-dir=" +
282 WideToUTF8(document_root_dir_.ToWStringHack())); 286 WideToUTF8(document_root_dir_.ToWStringHack()));
283 if (protocol == ProtoFTP) 287 if (protocol == ProtoFTP) {
284 command_line.push_back("-f"); 288 command_line.push_back("--ftp");
289 if (ftp_enable_anonymous_)
290 command_line.push_back("--ftp-enable-anonymous");
291 }
285 if (!cert_path.value().empty()) 292 if (!cert_path.value().empty())
286 command_line.push_back("--https=" + WideToUTF8(cert_path.ToWStringHack())); 293 command_line.push_back("--https=" + WideToUTF8(cert_path.ToWStringHack()));
287 if (forking_) 294 if (forking_)
288 command_line.push_back("--forking"); 295 command_line.push_back("--forking");
289 296
290 base::file_handle_mapping_vector no_mappings; 297 base::file_handle_mapping_vector no_mappings;
291 LOG(INFO) << "Trying to launch " << command_line[0] << " ..."; 298 LOG(INFO) << "Trying to launch " << command_line[0] << " ...";
292 if (!base::LaunchApp(command_line, no_mappings, false, &process_handle_)) { 299 if (!base::LaunchApp(command_line, no_mappings, false, &process_handle_)) {
293 LOG(ERROR) << "Failed to launch " << command_line[0] << " ..."; 300 LOG(ERROR) << "Failed to launch " << command_line[0] << " ...";
294 return false; 301 return false;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 "certificate to your trusted roots for this test to work. " 439 "certificate to your trusted roots for this test to work. "
433 "For more info visit:\n" 440 "For more info visit:\n"
434 "http://dev.chromium.org/developers/testing\n"; 441 "http://dev.chromium.org/developers/testing\n";
435 return false; 442 return false;
436 } 443 }
437 #endif 444 #endif
438 return true; 445 return true;
439 } 446 }
440 447
441 } // namespace net 448 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698