| 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/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/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/posix/global_descriptors.h" |
| 13 #include "base/process/kill.h" | 14 #include "base/process/kill.h" |
| 14 #include "base/process/launch.h" | 15 #include "base/process/launch.h" |
| 15 #include "base/test/test_timeouts.h" | 16 #include "base/test/test_timeouts.h" |
| 16 #include "chrome/common/importer/firefox_importer_utils.h" | 17 #include "chrome/common/importer/firefox_importer_utils.h" |
| 17 #include "ipc/ipc_channel.h" | 18 #include "ipc/ipc_channel.h" |
| 18 #include "ipc/ipc_descriptors.h" | 19 #include "ipc/ipc_descriptors.h" |
| 19 #include "ipc/ipc_listener.h" | 20 #include "ipc/ipc_listener.h" |
| 20 #include "ipc/ipc_message.h" | 21 #include "ipc/ipc_message.h" |
| 21 #include "ipc/ipc_multiprocess_test.h" | 22 #include "ipc/ipc_multiprocess_test.h" |
| 22 #include "ipc/ipc_switches.h" | 23 #include "ipc/ipc_switches.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 45 // why we need this. | 46 // why we need this. |
| 46 base::LaunchOptions options; | 47 base::LaunchOptions options; |
| 47 options.environ["DYLD_FALLBACK_LIBRARY_PATH"] = nss_path.value(); | 48 options.environ["DYLD_FALLBACK_LIBRARY_PATH"] = nss_path.value(); |
| 48 | 49 |
| 49 int ipcfd = channel->TakeClientFileDescriptor(); | 50 int ipcfd = channel->TakeClientFileDescriptor(); |
| 50 if (ipcfd == -1) | 51 if (ipcfd == -1) |
| 51 return false; | 52 return false; |
| 52 | 53 |
| 53 file_util::ScopedFD client_file_descriptor_closer(&ipcfd); | 54 file_util::ScopedFD client_file_descriptor_closer(&ipcfd); |
| 54 base::FileHandleMappingVector fds_to_map; | 55 base::FileHandleMappingVector fds_to_map; |
| 55 fds_to_map.push_back(std::pair<int,int>(ipcfd, kPrimaryIPCChannel + 3)); | 56 fds_to_map.push_back(std::pair<int,int>(ipcfd, |
| 57 kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); |
| 56 | 58 |
| 57 bool debug_on_start = CommandLine::ForCurrentProcess()->HasSwitch( | 59 bool debug_on_start = CommandLine::ForCurrentProcess()->HasSwitch( |
| 58 switches::kDebugChildren); | 60 switches::kDebugChildren); |
| 59 options.fds_to_remap = &fds_to_map; | 61 options.fds_to_remap = &fds_to_map; |
| 60 options.wait = debug_on_start; | 62 options.wait = debug_on_start; |
| 61 return base::LaunchProcess(cl.argv(), options, handle); | 63 return base::LaunchProcess(cl.argv(), options, handle); |
| 62 } | 64 } |
| 63 | 65 |
| 64 } // namespace | 66 } // namespace |
| 65 | 67 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 270 |
| 269 IPC::Channel channel(kTestChannelID, IPC::Channel::MODE_CLIENT, &listener); | 271 IPC::Channel channel(kTestChannelID, IPC::Channel::MODE_CLIENT, &listener); |
| 270 CHECK(channel.Connect()); | 272 CHECK(channel.Connect()); |
| 271 listener.SetSender(&channel); | 273 listener.SetSender(&channel); |
| 272 | 274 |
| 273 // run message loop | 275 // run message loop |
| 274 base::MessageLoop::current()->Run(); | 276 base::MessageLoop::current()->Run(); |
| 275 | 277 |
| 276 return 0; | 278 return 0; |
| 277 } | 279 } |
| OLD | NEW |