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

Side by Side Diff: chrome/utility/importer/firefox_importer_unittest_utils_mac.cc

Issue 197873014: Revert of 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
« no previous file with comments | « chrome/test/chromedriver/chrome_launcher.cc ('k') | components/nacl.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/utility/importer/firefox_importer_unittest_utils.h" 5 #include "chrome/utility/importer/firefox_importer_unittest_utils.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/files/scoped_file.h"
13 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
14 #include "base/posix/global_descriptors.h" 13 #include "base/posix/global_descriptors.h"
15 #include "base/process/kill.h" 14 #include "base/process/kill.h"
16 #include "base/process/launch.h" 15 #include "base/process/launch.h"
17 #include "base/test/test_timeouts.h" 16 #include "base/test/test_timeouts.h"
18 #include "chrome/common/importer/firefox_importer_utils.h" 17 #include "chrome/common/importer/firefox_importer_utils.h"
19 #include "ipc/ipc_channel.h" 18 #include "ipc/ipc_channel.h"
20 #include "ipc/ipc_descriptors.h" 19 #include "ipc/ipc_descriptors.h"
21 #include "ipc/ipc_listener.h" 20 #include "ipc/ipc_listener.h"
22 #include "ipc/ipc_message.h" 21 #include "ipc/ipc_message.h"
(...skipping 18 matching lines...) Expand all
41 IPC::Channel* channel, base::ProcessHandle* handle) { 40 IPC::Channel* channel, base::ProcessHandle* handle) {
42 CommandLine cl(*CommandLine::ForCurrentProcess()); 41 CommandLine cl(*CommandLine::ForCurrentProcess());
43 cl.AppendSwitchASCII(switches::kTestChildProcess, "NSSDecrypterChildProcess"); 42 cl.AppendSwitchASCII(switches::kTestChildProcess, "NSSDecrypterChildProcess");
44 43
45 // Set env variable needed for FF encryption libs to load. 44 // Set env variable needed for FF encryption libs to load.
46 // See "chrome/utility/importer/nss_decryptor_mac.mm" for an explanation of 45 // See "chrome/utility/importer/nss_decryptor_mac.mm" for an explanation of
47 // why we need this. 46 // why we need this.
48 base::LaunchOptions options; 47 base::LaunchOptions options;
49 options.environ["DYLD_FALLBACK_LIBRARY_PATH"] = nss_path.value(); 48 options.environ["DYLD_FALLBACK_LIBRARY_PATH"] = nss_path.value();
50 49
51 base::ScopedFD ipcfd(channel->TakeClientFileDescriptor()); 50 int ipcfd = channel->TakeClientFileDescriptor();
52 if (!ipcfd.is_valid()) 51 if (ipcfd == -1)
53 return false; 52 return false;
54 53
54 file_util::ScopedFD client_file_descriptor_closer(&ipcfd);
55 base::FileHandleMappingVector fds_to_map; 55 base::FileHandleMappingVector fds_to_map;
56 fds_to_map.push_back(std::pair<int,int>(ipcfd.get(), 56 fds_to_map.push_back(std::pair<int,int>(ipcfd,
57 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); 57 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
58 58
59 bool debug_on_start = CommandLine::ForCurrentProcess()->HasSwitch( 59 bool debug_on_start = CommandLine::ForCurrentProcess()->HasSwitch(
60 switches::kDebugChildren); 60 switches::kDebugChildren);
61 options.fds_to_remap = &fds_to_map; 61 options.fds_to_remap = &fds_to_map;
62 options.wait = debug_on_start; 62 options.wait = debug_on_start;
63 return base::LaunchProcess(cl.argv(), options, handle); 63 return base::LaunchProcess(cl.argv(), options, handle);
64 } 64 }
65 65
66 } // namespace 66 } // namespace
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 IPC::Channel channel(kTestChannelID, IPC::Channel::MODE_CLIENT, &listener); 271 IPC::Channel channel(kTestChannelID, IPC::Channel::MODE_CLIENT, &listener);
272 CHECK(channel.Connect()); 272 CHECK(channel.Connect());
273 listener.SetSender(&channel); 273 listener.SetSender(&channel);
274 274
275 // run message loop 275 // run message loop
276 base::MessageLoop::current()->Run(); 276 base::MessageLoop::current()->Run();
277 277
278 return 0; 278 return 0;
279 } 279 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/chrome_launcher.cc ('k') | components/nacl.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698