Index: net/tools/testserver/run_testserver.cc |
diff --git a/net/tools/testserver/run_testserver.cc b/net/tools/testserver/run_testserver.cc |
index 2341512ba7c5ffd229bbb665298f513d6d7a6873..4e4220a401d227d96075a0be2b70b84cc45c16f9 100644 |
--- a/net/tools/testserver/run_testserver.cc |
+++ b/net/tools/testserver/run_testserver.cc |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -9,68 +9,15 @@ |
#include "base/file_path.h" |
#include "base/logging.h" |
#include "base/message_loop.h" |
-#include "base/process_util.h" |
-#include "base/string_number_conversions.h" |
#include "base/test/test_timeouts.h" |
#include "base/utf_string_conversions.h" |
-#include "net/test/local_sync_test_server.h" |
-#include "net/test/python_utils.h" |
#include "net/test/test_server.h" |
static void PrintUsage() { |
printf("run_testserver --doc-root=relpath\n" |
- " [--http|--https|--ws|--wss|--ftp|--sync]\n" |
- " [--ssl-cert=ok|mismatched-name|expired]\n" |
- " [--port=<port>] [--xmpp-port=<xmpp_port>]\n"); |
+ " [--http|--https|--ws|--wss|--ftp]\n" |
+ " [--ssl-cert=ok|mismatched-name|expired]\n"); |
printf("(NOTE: relpath should be relative to the 'src' directory.\n"); |
- printf(" --port and --xmpp-port only work with the --sync flag.)\n"); |
-} |
- |
-// Launches the chromiumsync_test script, testing the --sync functionality. |
-static bool RunSyncTest() { |
- if (!net::TestServer::SetPythonPathStatic()) { |
- LOG(ERROR) << "Error trying to set python path. Exiting."; |
- return false; |
- } |
- |
- FilePath sync_test_path; |
- if (!net::TestServer::GetTestServerDirectory(&sync_test_path)) { |
- LOG(ERROR) << "Error trying to get python test server path."; |
- return false; |
- } |
- |
- sync_test_path = |
- sync_test_path.Append(FILE_PATH_LITERAL("chromiumsync_test.py")); |
- |
- CommandLine python_command(CommandLine::NO_PROGRAM); |
- if (!GetPythonCommand(&python_command)) { |
- LOG(ERROR) << "Could not get python runtime command."; |
- return false; |
- } |
- |
- python_command.AppendArgPath(sync_test_path); |
- if (!base::LaunchProcess(python_command, base::LaunchOptions(), NULL)) { |
- LOG(ERROR) << "Failed to launch test script."; |
- return false; |
- } |
- return true; |
-} |
- |
-// Gets a port value from the switch with name |switch_name| and writes it to |
-// |port|. Returns true if successful and false otherwise. |
-static bool GetPortFromSwitch(const std::string& switch_name, uint16* port) { |
- DCHECK(port != NULL) << "|port| is NULL"; |
- CommandLine* command_line = CommandLine::ForCurrentProcess(); |
- int port_int = 0; |
- if (command_line->HasSwitch(switch_name)) { |
- std::string port_str = command_line->GetSwitchValueASCII(switch_name); |
- if (!base::StringToInt(port_str, &port_int)) { |
- LOG(WARNING) << "Could not extract port from switch " << switch_name; |
- return false; |
- } |
- } |
- *port = static_cast<uint16>(port_int); |
- return true; |
} |
int main(int argc, const char* argv[]) { |
@@ -94,10 +41,7 @@ int main(int argc, const char* argv[]) { |
TestTimeouts::Initialize(); |
if (command_line->GetSwitches().empty() || |
- command_line->HasSwitch("help") || |
- ((command_line->HasSwitch("port") || |
- command_line->HasSwitch("xmpp-port")) && |
- !command_line->HasSwitch("sync"))) { |
+ command_line->HasSwitch("help")) { |
PrintUsage(); |
return -1; |
} |
@@ -113,10 +57,6 @@ int main(int argc, const char* argv[]) { |
server_type = net::TestServer::TYPE_WSS; |
} else if (command_line->HasSwitch("ftp")) { |
server_type = net::TestServer::TYPE_FTP; |
- } else if (command_line->HasSwitch("sync")) { |
- server_type = net::TestServer::TYPE_SYNC; |
- } else if (command_line->HasSwitch("sync-test")) { |
- return RunSyncTest() ? 0 : -1; |
} else { |
// If no scheme switch is specified, select http or https scheme. |
// TODO(toyoshim): Remove this estimation. |
@@ -150,7 +90,7 @@ int main(int argc, const char* argv[]) { |
} |
FilePath doc_root = command_line->GetSwitchValuePath("doc-root"); |
- if ((server_type != net::TestServer::TYPE_SYNC) && doc_root.empty()) { |
+ if (doc_root.empty()) { |
printf("Error: --doc-root must be specified\n"); |
PrintUsage(); |
return -1; |
@@ -159,15 +99,6 @@ int main(int argc, const char* argv[]) { |
scoped_ptr<net::TestServer> test_server; |
if (net::TestServer::UsingSSL(server_type)) { |
test_server.reset(new net::TestServer(server_type, ssl_options, doc_root)); |
- } else if (server_type == net::TestServer::TYPE_SYNC) { |
- uint16 port = 0; |
- uint16 xmpp_port = 0; |
- if (!GetPortFromSwitch("port", &port) || |
- !GetPortFromSwitch("xmpp-port", &xmpp_port)) { |
- printf("Error: Could not extract --port and/or --xmpp-port.\n"); |
- return -1; |
- } |
- test_server.reset(new net::LocalSyncTestServer(port, xmpp_port)); |
} else { |
test_server.reset(new net::TestServer(server_type, |
net::TestServer::kLocalhost, |