| 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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/test/test_timeouts.h" | 13 #include "base/test/test_timeouts.h" |
| 14 #include "net/test/spawned_test_server/spawned_test_server.h" | 14 #include "net/test/spawned_test_server/spawned_test_server.h" |
| 15 | 15 |
| 16 static void PrintUsage() { | 16 static void PrintUsage() { |
| 17 printf("run_testserver --doc-root=relpath\n" | 17 printf("run_testserver --doc-root=relpath\n" |
| 18 " [--http|--https|--ws|--wss|--ftp]\n" | 18 " [--http|--https|--ws|--wss|--ftp]\n" |
| 19 " [--ssl-cert=ok|mismatched-name|expired]\n"); | 19 " [--ssl-cert=ok|mismatched-name|expired]\n"); |
| 20 printf("(NOTE: relpath should be relative to the 'src' directory.\n"); | 20 printf("(NOTE: relpath should be relative to the 'src' directory.\n"); |
| 21 } | 21 } |
| 22 | 22 |
| 23 int main(int argc, const char* argv[]) { | 23 int main(int argc, const char* argv[]) { |
| 24 base::AtExitManager at_exit_manager; | 24 base::AtExitManager at_exit_manager; |
| 25 base::MessageLoopForIO message_loop; | 25 base::MessageLoopForIO message_loop; |
| 26 | 26 |
| 27 // Process command line | 27 // Process command line |
| 28 CommandLine::Init(argc, argv); | 28 base::CommandLine::Init(argc, argv); |
| 29 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 29 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 30 | 30 |
| 31 logging::LoggingSettings settings; | 31 logging::LoggingSettings settings; |
| 32 settings.logging_dest = logging::LOG_TO_ALL; | 32 settings.logging_dest = logging::LOG_TO_ALL; |
| 33 settings.log_file = FILE_PATH_LITERAL("testserver.log"); | 33 settings.log_file = FILE_PATH_LITERAL("testserver.log"); |
| 34 if (!logging::InitLogging(settings)) { | 34 if (!logging::InitLogging(settings)) { |
| 35 printf("Error: could not initialize logging. Exiting.\n"); | 35 printf("Error: could not initialize logging. Exiting.\n"); |
| 36 return -1; | 36 return -1; |
| 37 } | 37 } |
| 38 | 38 |
| 39 TestTimeouts::Initialize(); | 39 TestTimeouts::Initialize(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 test_server->document_root().LossyDisplayName()).c_str()); | 117 test_server->document_root().LossyDisplayName()).c_str()); |
| 118 return -1; | 118 return -1; |
| 119 } | 119 } |
| 120 | 120 |
| 121 printf("testserver running at %s (type ctrl+c to exit)\n", | 121 printf("testserver running at %s (type ctrl+c to exit)\n", |
| 122 test_server->host_port_pair().ToString().c_str()); | 122 test_server->host_port_pair().ToString().c_str()); |
| 123 | 123 |
| 124 message_loop.Run(); | 124 message_loop.Run(); |
| 125 return 0; | 125 return 0; |
| 126 } | 126 } |
| OLD | NEW |