OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 if ((server_type != net::TestServer::TYPE_SYNC) && doc_root.empty()) { | 76 if ((server_type != net::TestServer::TYPE_SYNC) && doc_root.empty()) { |
77 printf("Error: --doc-root must be specified\n"); | 77 printf("Error: --doc-root must be specified\n"); |
78 PrintUsage(); | 78 PrintUsage(); |
79 return -1; | 79 return -1; |
80 } | 80 } |
81 | 81 |
82 scoped_ptr<net::TestServer> test_server; | 82 scoped_ptr<net::TestServer> test_server; |
83 if (server_type == net::TestServer::TYPE_HTTPS) | 83 if (server_type == net::TestServer::TYPE_HTTPS) |
84 test_server.reset(new net::TestServer(https_options, doc_root)); | 84 test_server.reset(new net::TestServer(https_options, doc_root)); |
85 else | 85 else |
86 test_server.reset(new net::TestServer(server_type, doc_root)); | 86 test_server.reset(new net::TestServer(server_type, |
| 87 net::TestServer::kLocalhost, |
| 88 doc_root)); |
87 | 89 |
88 if (!test_server->Start()) { | 90 if (!test_server->Start()) { |
89 printf("Error: failed to start test server. Exiting.\n"); | 91 printf("Error: failed to start test server. Exiting.\n"); |
90 return -1; | 92 return -1; |
91 } | 93 } |
92 | 94 |
93 if (!file_util::DirectoryExists(test_server->document_root())) { | 95 if (!file_util::DirectoryExists(test_server->document_root())) { |
94 printf("Error: invalid doc root: \"%s\" does not exist!\n", | 96 printf("Error: invalid doc root: \"%s\" does not exist!\n", |
95 UTF16ToUTF8(test_server->document_root().LossyDisplayName()).c_str()); | 97 UTF16ToUTF8(test_server->document_root().LossyDisplayName()).c_str()); |
96 return -1; | 98 return -1; |
97 } | 99 } |
98 | 100 |
99 printf("testserver running at %s (type ctrl+c to exit)\n", | 101 printf("testserver running at %s (type ctrl+c to exit)\n", |
100 test_server->host_port_pair().ToString().c_str()); | 102 test_server->host_port_pair().ToString().c_str()); |
101 | 103 |
102 message_loop.Run(); | 104 message_loop.Run(); |
103 return 0; | 105 return 0; |
104 } | 106 } |
OLD | NEW |