Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: chrome/test/automation/proxy_launcher.cc

Issue 191673003: Implement ScopedFD in terms of ScopedGeneric. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 483
483 if (main_launch) 484 if (main_launch)
484 browser_launch_time_ = base::TimeTicks::Now(); 485 browser_launch_time_ = base::TimeTicks::Now();
485 486
486 base::LaunchOptions options; 487 base::LaunchOptions options;
487 options.wait = wait; 488 options.wait = wait;
488 489
489 #if defined(OS_WIN) 490 #if defined(OS_WIN)
490 options.start_hidden = !state.show_window; 491 options.start_hidden = !state.show_window;
491 #elif defined(OS_POSIX) 492 #elif defined(OS_POSIX)
492 int ipcfd = -1; 493 base::ScopedFD ipcfd;
493 file_util::ScopedFD ipcfd_closer(&ipcfd);
494 base::FileHandleMappingVector fds; 494 base::FileHandleMappingVector fds;
495 if (main_launch && automation_proxy_.get()) { 495 if (main_launch && automation_proxy_.get()) {
496 ipcfd = automation_proxy_->channel()->TakeClientFileDescriptor(); 496 ipcfd.reset(automation_proxy_->channel()->TakeClientFileDescriptor());
497 fds.push_back(std::make_pair(ipcfd, 497 fds.push_back(std::make_pair(ipcfd.get(),
498 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); 498 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
499 options.fds_to_remap = &fds; 499 options.fds_to_remap = &fds;
500 } 500 }
501 #endif 501 #endif
502 502
503 return base::LaunchProcess(command_line, options, process); 503 return base::LaunchProcess(command_line, options, process);
504 } 504 }
505 505
506 AutomationProxy* ProxyLauncher::automation() const { 506 AutomationProxy* ProxyLauncher::automation() const {
507 EXPECT_TRUE(automation_proxy_.get()); 507 EXPECT_TRUE(automation_proxy_.get());
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 return LaunchBrowserAndServer(state, wait_for_initial_loads); 622 return LaunchBrowserAndServer(state, wait_for_initial_loads);
623 } 623 }
624 624
625 void AnonymousProxyLauncher::TerminateConnection() { 625 void AnonymousProxyLauncher::TerminateConnection() {
626 CloseBrowserAndServer(); 626 CloseBrowserAndServer();
627 } 627 }
628 628
629 std::string AnonymousProxyLauncher::PrefixedChannelID() const { 629 std::string AnonymousProxyLauncher::PrefixedChannelID() const {
630 return channel_id_; 630 return channel_id_;
631 } 631 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698