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 <stdint.h> | 5 #include <stdint.h> |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/process/launch.h" | 13 #include "base/process/launch.h" |
14 #include "base/run_loop.h" | |
14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
15 #include "base/test/test_timeouts.h" | 16 #include "base/test/test_timeouts.h" |
16 #include "components/sync/test/local_sync_test_server.h" | 17 #include "components/sync/test/local_sync_test_server.h" |
17 #include "net/test/python_utils.h" | 18 #include "net/test/python_utils.h" |
18 | 19 |
19 static void PrintUsage() { | 20 static void PrintUsage() { |
20 printf("run_sync_testserver [--port=<port>] [--xmpp-port=<xmpp_port>]\n"); | 21 printf("run_sync_testserver [--port=<port>] [--xmpp-port=<xmpp_port>]\n"); |
21 } | 22 } |
22 | 23 |
23 // Launches the chromiumsync_test.py or xmppserver_test.py scripts, which test | 24 // Launches the chromiumsync_test.py or xmppserver_test.py scripts, which test |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 if (!base::StringToInt(port_str, &port_int)) { | 65 if (!base::StringToInt(port_str, &port_int)) { |
65 return false; | 66 return false; |
66 } | 67 } |
67 } | 68 } |
68 *port = static_cast<uint16_t>(port_int); | 69 *port = static_cast<uint16_t>(port_int); |
69 return true; | 70 return true; |
70 } | 71 } |
71 | 72 |
72 int main(int argc, const char* argv[]) { | 73 int main(int argc, const char* argv[]) { |
73 base::AtExitManager at_exit_manager; | 74 base::AtExitManager at_exit_manager; |
74 base::MessageLoopForIO message_loop; | 75 base::MessageLoopForIO message_loop; |
Cait (Slow)
2016/08/08 15:34:57
is this still needed?
fdoray
2016/08/08 15:39:52
Yes. RunLoop::Run() has to be called in the scope
| |
75 | 76 |
76 // Process command line | 77 // Process command line |
77 base::CommandLine::Init(argc, argv); | 78 base::CommandLine::Init(argc, argv); |
78 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 79 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
79 | 80 |
80 logging::LoggingSettings settings; | 81 logging::LoggingSettings settings; |
81 settings.logging_dest = logging::LOG_TO_ALL; | 82 settings.logging_dest = logging::LOG_TO_ALL; |
82 settings.log_file = FILE_PATH_LITERAL("sync_testserver.log"); | 83 settings.log_file = FILE_PATH_LITERAL("sync_testserver.log"); |
83 if (!logging::InitLogging(settings)) { | 84 if (!logging::InitLogging(settings)) { |
84 printf("Error: could not initialize logging. Exiting.\n"); | 85 printf("Error: could not initialize logging. Exiting.\n"); |
(...skipping 24 matching lines...) Expand all Loading... | |
109 std::unique_ptr<syncer::LocalSyncTestServer> test_server( | 110 std::unique_ptr<syncer::LocalSyncTestServer> test_server( |
110 new syncer::LocalSyncTestServer(port, xmpp_port)); | 111 new syncer::LocalSyncTestServer(port, xmpp_port)); |
111 if (!test_server->Start()) { | 112 if (!test_server->Start()) { |
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 base::RunLoop().Run(); |
120 return 0; | 121 return 0; |
121 } | 122 } |
OLD | NEW |