| 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 "chrome/test/chromedriver/chrome_launcher.h" | 5 #include "chrome/test/chromedriver/chrome_launcher.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 return LaunchRemoteChromeSession( | 488 return LaunchRemoteChromeSession( |
| 489 context_getter, socket_factory, | 489 context_getter, socket_factory, |
| 490 capabilities, devtools_event_listeners, chrome); | 490 capabilities, devtools_event_listeners, chrome); |
| 491 } | 491 } |
| 492 | 492 |
| 493 int port = 0; | 493 int port = 0; |
| 494 scoped_ptr<PortReservation> port_reservation; | 494 scoped_ptr<PortReservation> port_reservation; |
| 495 Status port_status(kOk); | 495 Status port_status(kOk); |
| 496 | 496 |
| 497 if (capabilities.IsAndroid()) { | 497 if (capabilities.IsAndroid()) { |
| 498 port_status = port_manager->ReservePortFromPool(&port, &port_reservation); | 498 if (port_server) |
| 499 port_status = port_server->ReservePort(&port, &port_reservation); |
| 500 else |
| 501 port_status = port_manager->ReservePortFromPool(&port, &port_reservation); |
| 499 if (port_status.IsError()) | 502 if (port_status.IsError()) |
| 500 return Status(kUnknownError, "cannot reserve port for Chrome", | 503 return Status(kUnknownError, "cannot reserve port for Chrome", |
| 501 port_status); | 504 port_status); |
| 502 return LaunchAndroidChrome(context_getter, | 505 return LaunchAndroidChrome(context_getter, |
| 503 port, | 506 port, |
| 504 port_reservation.Pass(), | 507 port_reservation.Pass(), |
| 505 socket_factory, | 508 socket_factory, |
| 506 capabilities, | 509 capabilities, |
| 507 devtools_event_listeners, | 510 devtools_event_listeners, |
| 508 device_manager, | 511 device_manager, |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 // Write empty "First Run" file, otherwise Chrome will wipe the default | 814 // Write empty "First Run" file, otherwise Chrome will wipe the default |
| 812 // profile that was written. | 815 // profile that was written. |
| 813 if (base::WriteFile( | 816 if (base::WriteFile( |
| 814 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { | 817 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { |
| 815 return Status(kUnknownError, "failed to write first run file"); | 818 return Status(kUnknownError, "failed to write first run file"); |
| 816 } | 819 } |
| 817 return Status(kOk); | 820 return Status(kOk); |
| 818 } | 821 } |
| 819 | 822 |
| 820 } // namespace internal | 823 } // namespace internal |
| OLD | NEW |