OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/process_util.h" | 12 #include "base/process_util.h" |
13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
14 #include "base/test/test_timeouts.h" | 14 #include "base/test/test_timeouts.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "net/test/local_sync_test_server.h" | 16 #include "net/test/local_sync_test_server.h" |
17 #include "net/test/python_utils.h" | 17 #include "net/test/python_utils.h" |
18 #include "net/test/test_server.h" | 18 #include "net/test/test_server.h" |
19 | 19 |
20 static void PrintUsage() { | 20 static void PrintUsage() { |
21 printf("run_testserver --doc-root=relpath [--http|--https|--ftp|--sync]\n" | 21 printf("run_testserver --doc-root=relpath [--http|--https|--ftp|--sync]\n" |
22 " [--https-cert=ok|mismatched-name|expired]\n" | 22 " [--https-cert=ok|mismatched-name|expired]\n" |
23 " [--port=<port>] [--xmpp-port=<xmpp_port>]\n"); | 23 " [--port=<port>] [--xmpp-port=<xmpp_port>]\n"); |
24 printf("(NOTE: relpath should be relative to the 'src' directory.\n"); | 24 printf("(NOTE: relpath should be relative to the 'src' directory.\n"); |
25 printf(" --port and --xmpp-port only work with the --sync flag.)\n"); | 25 printf(" --port and --xmpp-port only work with the --sync flag.)\n"); |
26 } | 26 } |
27 | 27 |
28 // Launches the chromiumsync_test script, testing the --sync functionality. | 28 // Launches the chromiumsync_test script, testing the --sync functionality. |
29 static bool RunSyncTest() { | 29 static bool RunSyncTest() { |
30 if (!net::TestServer::SetPythonPath()) { | 30 if (!net::TestServer::SetPythonPathStatic()) { |
31 LOG(ERROR) << "Error trying to set python path. Exiting."; | 31 LOG(ERROR) << "Error trying to set python path. Exiting."; |
32 return false; | 32 return false; |
33 } | 33 } |
34 | 34 |
35 FilePath sync_test_path; | 35 FilePath sync_test_path; |
36 if (!net::TestServer::GetTestServerDirectory(&sync_test_path)) { | 36 if (!net::TestServer::GetTestServerDirectory(&sync_test_path)) { |
37 LOG(ERROR) << "Error trying to get python test server path."; | 37 LOG(ERROR) << "Error trying to get python test server path."; |
38 return false; | 38 return false; |
39 } | 39 } |
40 | 40 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 UTF16ToUTF8(test_server->document_root().LossyDisplayName()).c_str()); | 175 UTF16ToUTF8(test_server->document_root().LossyDisplayName()).c_str()); |
176 return -1; | 176 return -1; |
177 } | 177 } |
178 | 178 |
179 printf("testserver running at %s (type ctrl+c to exit)\n", | 179 printf("testserver running at %s (type ctrl+c to exit)\n", |
180 test_server->host_port_pair().ToString().c_str()); | 180 test_server->host_port_pair().ToString().c_str()); |
181 | 181 |
182 message_loop.Run(); | 182 message_loop.Run(); |
183 return 0; | 183 return 0; |
184 } | 184 } |
OLD | NEW |