diff options
Diffstat (limited to 'net/tools/testserver/run_testserver.cc')
-rw-r--r-- | net/tools/testserver/run_testserver.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/net/tools/testserver/run_testserver.cc b/net/tools/testserver/run_testserver.cc index 51b9aac..f00f9f2 100644 --- a/net/tools/testserver/run_testserver.cc +++ b/net/tools/testserver/run_testserver.cc @@ -9,8 +9,10 @@ #include "base/file_path.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/process_util.h" #include "base/test/test_timeouts.h" #include "base/utf_string_conversions.h" +#include "net/test/python_utils.h" #include "net/test/test_server.h" static void PrintUsage() { @@ -19,6 +21,36 @@ static void PrintUsage() { printf("(NOTE: relpath should be relative to the 'src' directory)\n"); } +// Launches the chromiumsync_test script, testing the --sync functionality. +static bool RunSyncTest() { + if (!net::TestServer::SetPythonPath()) { + 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")); + FilePath python_runtime; + if (!GetPythonRunTime(&python_runtime)) { + LOG(ERROR) << "Could not get python runtime command."; + return false; + } + + CommandLine python_command(python_runtime); + 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; +} + int main(int argc, const char* argv[]) { base::AtExitManager at_exit_manager; MessageLoopForIO message_loop; @@ -51,6 +83,8 @@ int main(int argc, const char* argv[]) { 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; } net::TestServer::HTTPSOptions https_options; |