OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include <locale> | 6 #include <locale> |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 if (url_base.empty() || url_base[0] != '/') | 286 if (url_base.empty() || url_base[0] != '/') |
287 url_base = "/" + url_base; | 287 url_base = "/" + url_base; |
288 if (url_base[url_base.length() - 1] != '/') | 288 if (url_base[url_base.length() - 1] != '/') |
289 url_base = url_base + "/"; | 289 url_base = url_base + "/"; |
290 if (cmd_line->HasSwitch("whitelisted-ips")) { | 290 if (cmd_line->HasSwitch("whitelisted-ips")) { |
291 allow_remote = true; | 291 allow_remote = true; |
292 std::string whitelist = cmd_line->GetSwitchValueASCII("whitelisted-ips"); | 292 std::string whitelist = cmd_line->GetSwitchValueASCII("whitelisted-ips"); |
293 base::SplitString(whitelist, ',', &whitelisted_ips); | 293 base::SplitString(whitelist, ',', &whitelisted_ips); |
294 } | 294 } |
295 if (!cmd_line->HasSwitch("silent")) { | 295 if (!cmd_line->HasSwitch("silent")) { |
296 printf( | 296 printf("Starting ChromeDriver %s on port %d\n", kChromeDriverVersion, port); |
297 "Starting ChromeDriver (v%s) on port %d\n", kChromeDriverVersion, port); | |
298 if (!allow_remote) { | 297 if (!allow_remote) { |
299 printf("Only local connections are allowed.\n"); | 298 printf("Only local connections are allowed.\n"); |
300 } else if (!whitelisted_ips.empty()) { | 299 } else if (!whitelisted_ips.empty()) { |
301 printf("Remote connections are allowed by a whitelist (%s).\n", | 300 printf("Remote connections are allowed by a whitelist (%s).\n", |
302 cmd_line->GetSwitchValueASCII("whitelisted-ips").c_str()); | 301 cmd_line->GetSwitchValueASCII("whitelisted-ips").c_str()); |
303 } else { | 302 } else { |
304 printf("All remote connections are allowed. Use a whitelist instead!\n"); | 303 printf("All remote connections are allowed. Use a whitelist instead!\n"); |
305 } | 304 } |
306 fflush(stdout); | 305 fflush(stdout); |
307 } | 306 } |
308 | 307 |
309 if (!InitLogging()) { | 308 if (!InitLogging()) { |
310 printf("Unable to initialize logging. Exiting...\n"); | 309 printf("Unable to initialize logging. Exiting...\n"); |
311 return 1; | 310 return 1; |
312 } | 311 } |
313 RunServer(port, allow_remote, whitelisted_ips, | 312 RunServer(port, allow_remote, whitelisted_ips, |
314 url_base, adb_port, port_server.Pass()); | 313 url_base, adb_port, port_server.Pass()); |
315 return 0; | 314 return 0; |
316 } | 315 } |
OLD | NEW |