OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/automation/proxy_launcher.h" | 5 #include "chrome/test/automation/proxy_launcher.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/files/file_enumerator.h" | 11 #include "base/files/file_enumerator.h" |
| 12 #include "base/files/scoped_file.h" |
12 #include "base/process/kill.h" | 13 #include "base/process/kill.h" |
13 #include "base/process/launch.h" | 14 #include "base/process/launch.h" |
14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
18 #include "base/test/test_file_util.h" | 19 #include "base/test/test_file_util.h" |
19 #include "base/test/test_timeouts.h" | 20 #include "base/test/test_timeouts.h" |
20 #include "chrome/app/chrome_command_ids.h" | 21 #include "chrome/app/chrome_command_ids.h" |
21 #include "chrome/common/automation_constants.h" | 22 #include "chrome/common/automation_constants.h" |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 | 487 |
487 if (main_launch) | 488 if (main_launch) |
488 browser_launch_time_ = base::TimeTicks::Now(); | 489 browser_launch_time_ = base::TimeTicks::Now(); |
489 | 490 |
490 base::LaunchOptions options; | 491 base::LaunchOptions options; |
491 options.wait = wait; | 492 options.wait = wait; |
492 | 493 |
493 #if defined(OS_WIN) | 494 #if defined(OS_WIN) |
494 options.start_hidden = !state.show_window; | 495 options.start_hidden = !state.show_window; |
495 #elif defined(OS_POSIX) | 496 #elif defined(OS_POSIX) |
496 int ipcfd = -1; | 497 base::ScopedFD ipcfd; |
497 file_util::ScopedFD ipcfd_closer(&ipcfd); | |
498 base::FileHandleMappingVector fds; | 498 base::FileHandleMappingVector fds; |
499 if (main_launch && automation_proxy_.get()) { | 499 if (main_launch && automation_proxy_.get()) { |
500 ipcfd = automation_proxy_->channel()->TakeClientFileDescriptor(); | 500 ipcfd.reset(automation_proxy_->channel()->TakeClientFileDescriptor()); |
501 fds.push_back(std::make_pair(ipcfd, | 501 fds.push_back(std::make_pair(ipcfd.get(), |
502 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); | 502 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); |
503 options.fds_to_remap = &fds; | 503 options.fds_to_remap = &fds; |
504 } | 504 } |
505 #endif | 505 #endif |
506 | 506 |
507 return base::LaunchProcess(command_line, options, process); | 507 return base::LaunchProcess(command_line, options, process); |
508 } | 508 } |
509 | 509 |
510 AutomationProxy* ProxyLauncher::automation() const { | 510 AutomationProxy* ProxyLauncher::automation() const { |
511 EXPECT_TRUE(automation_proxy_.get()); | 511 EXPECT_TRUE(automation_proxy_.get()); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 return LaunchBrowserAndServer(state, wait_for_initial_loads); | 626 return LaunchBrowserAndServer(state, wait_for_initial_loads); |
627 } | 627 } |
628 | 628 |
629 void AnonymousProxyLauncher::TerminateConnection() { | 629 void AnonymousProxyLauncher::TerminateConnection() { |
630 CloseBrowserAndServer(); | 630 CloseBrowserAndServer(); |
631 } | 631 } |
632 | 632 |
633 std::string AnonymousProxyLauncher::PrefixedChannelID() const { | 633 std::string AnonymousProxyLauncher::PrefixedChannelID() const { |
634 return channel_id_; | 634 return channel_id_; |
635 } | 635 } |
OLD | NEW |