OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "net/test/test_server.h" | 12 #include "net/test/test_server.h" |
13 | 13 |
14 static void PrintUsage() { | 14 static void PrintUsage() { |
15 printf("run_testserver --doc-root=relpath [--http|--https|--ftp|--sync]\n"); | 15 printf("run_testserver --doc-root=relpath [--http|--https|--ftp|--sync]\n"); |
16 printf("(NOTE: relpath should be relative to the 'src' directory)\n"); | 16 printf("(NOTE: relpath should be relative to the 'src' directory)\n"); |
17 } | 17 } |
18 | 18 |
19 int main(int argc, const char* argv[]) { | 19 int main(int argc, const char* argv[]) { |
20 base::AtExitManager at_exit_manager; | 20 base::AtExitManager at_exit_manager; |
21 MessageLoopForIO message_loop; | 21 MessageLoopForIO message_loop; |
22 | 22 |
23 // Process command line | 23 // Process command line |
24 CommandLine::Init(argc, argv); | 24 CommandLine::Init(argc, argv); |
25 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 25 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
26 | 26 |
27 if (!logging::InitLogging(FILE_PATH_LITERAL("testserver.log"), | 27 if (!logging::InitLogging( |
28 logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, | 28 FILE_PATH_LITERAL("testserver.log"), |
29 logging::LOCK_LOG_FILE, | 29 logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, |
30 logging::APPEND_TO_OLD_LOG_FILE)) { | 30 logging::LOCK_LOG_FILE, |
| 31 logging::APPEND_TO_OLD_LOG_FILE, |
| 32 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS)) { |
31 printf("Error: could not initialize logging. Exiting.\n"); | 33 printf("Error: could not initialize logging. Exiting.\n"); |
32 return -1; | 34 return -1; |
33 } | 35 } |
34 | 36 |
35 if (command_line->GetSwitchCount() == 0 || | 37 if (command_line->GetSwitchCount() == 0 || |
36 command_line->HasSwitch("help")) { | 38 command_line->HasSwitch("help")) { |
37 PrintUsage(); | 39 PrintUsage(); |
38 return -1; | 40 return -1; |
39 } | 41 } |
40 | 42 |
(...skipping 18 matching lines...) Expand all Loading... |
59 printf("Error: failed to start test server. Exiting.\n"); | 61 printf("Error: failed to start test server. Exiting.\n"); |
60 return -1; | 62 return -1; |
61 } | 63 } |
62 | 64 |
63 printf("testserver running at %s (type ctrl+c to exit)\n", | 65 printf("testserver running at %s (type ctrl+c to exit)\n", |
64 test_server.host_port_pair().ToString().c_str()); | 66 test_server.host_port_pair().ToString().c_str()); |
65 | 67 |
66 message_loop.Run(); | 68 message_loop.Run(); |
67 return 0; | 69 return 0; |
68 } | 70 } |
OLD | NEW |