OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "net/test/python_utils.h" | 15 #include "net/test/python_utils.h" |
16 #include "sync/test/local_sync_test_server.h" | 16 #include "sync/test/local_sync_test_server.h" |
17 | 17 |
18 static void PrintUsage() { | 18 static void PrintUsage() { |
19 printf("run_sync_testserver [--port=<port>] [--xmpp-port=<xmpp_port>]\n"); | 19 printf("run_sync_testserver [--port=<port>] [--xmpp-port=<xmpp_port>]\n"); |
20 } | 20 } |
21 | 21 |
22 // Launches the chromiumsync_test.py or xmppserver_test.py scripts, which test | 22 // Launches the chromiumsync_test.py or xmppserver_test.py scripts, which test |
23 // the sync HTTP and XMPP sever functionality respectively. | 23 // the sync HTTP and XMPP sever functionality respectively. |
24 static bool RunSyncTest(const FilePath::StringType& sync_test_script_name) { | 24 static bool RunSyncTest( |
| 25 const base::FilePath::StringType& sync_test_script_name) { |
25 scoped_ptr<syncer::LocalSyncTestServer> test_server( | 26 scoped_ptr<syncer::LocalSyncTestServer> test_server( |
26 new syncer::LocalSyncTestServer()); | 27 new syncer::LocalSyncTestServer()); |
27 if (!test_server->SetPythonPath()) { | 28 if (!test_server->SetPythonPath()) { |
28 LOG(ERROR) << "Error trying to set python path. Exiting."; | 29 LOG(ERROR) << "Error trying to set python path. Exiting."; |
29 return false; | 30 return false; |
30 } | 31 } |
31 | 32 |
32 FilePath sync_test_script_path; | 33 base::FilePath sync_test_script_path; |
33 if (!test_server->GetTestScriptPath(sync_test_script_name, | 34 if (!test_server->GetTestScriptPath(sync_test_script_name, |
34 &sync_test_script_path)) { | 35 &sync_test_script_path)) { |
35 LOG(ERROR) << "Error trying to get path for test script " | 36 LOG(ERROR) << "Error trying to get path for test script " |
36 << sync_test_script_name; | 37 << sync_test_script_name; |
37 return false; | 38 return false; |
38 } | 39 } |
39 | 40 |
40 CommandLine python_command(CommandLine::NO_PROGRAM); | 41 CommandLine python_command(CommandLine::NO_PROGRAM); |
41 if (!GetPythonCommand(&python_command)) { | 42 if (!GetPythonCommand(&python_command)) { |
42 LOG(ERROR) << "Could not get python runtime command."; | 43 LOG(ERROR) << "Could not get python runtime command."; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 printf("Error: failed to start python sync test server. Exiting.\n"); | 113 printf("Error: failed to start python sync test server. Exiting.\n"); |
113 return -1; | 114 return -1; |
114 } | 115 } |
115 | 116 |
116 printf("Python sync test server running at %s (type ctrl+c to exit)\n", | 117 printf("Python sync test server running at %s (type ctrl+c to exit)\n", |
117 test_server->host_port_pair().ToString().c_str()); | 118 test_server->host_port_pair().ToString().c_str()); |
118 | 119 |
119 message_loop.Run(); | 120 message_loop.Run(); |
120 return 0; | 121 return 0; |
121 } | 122 } |
OLD | NEW |