| 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/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 const std::string& mojo_channel_token) { | 48 const std::string& mojo_channel_token) { |
| 49 base::CommandLine cl(*base::CommandLine::ForCurrentProcess()); | 49 base::CommandLine cl(*base::CommandLine::ForCurrentProcess()); |
| 50 cl.AppendSwitchASCII(switches::kTestChildProcess, "NSSDecrypterChildProcess"); | 50 cl.AppendSwitchASCII(switches::kTestChildProcess, "NSSDecrypterChildProcess"); |
| 51 cl.AppendSwitchASCII(switches::kMojoChannelToken, mojo_channel_token); | 51 cl.AppendSwitchASCII(switches::kMojoChannelToken, mojo_channel_token); |
| 52 | 52 |
| 53 // Set env variable needed for FF encryption libs to load. | 53 // Set env variable needed for FF encryption libs to load. |
| 54 // See "chrome/utility/importer/nss_decryptor_mac.mm" for an explanation of | 54 // See "chrome/utility/importer/nss_decryptor_mac.mm" for an explanation of |
| 55 // why we need this. | 55 // why we need this. |
| 56 base::LaunchOptions options; | 56 base::LaunchOptions options; |
| 57 options.environ["DYLD_FALLBACK_LIBRARY_PATH"] = nss_path.value(); | 57 options.environ["DYLD_FALLBACK_LIBRARY_PATH"] = nss_path.value(); |
| 58 | 58 options.fds_to_remap.push_back(std::pair<int, int>( |
| 59 base::FileHandleMappingVector fds_to_map; | |
| 60 fds_to_map.push_back(std::pair<int, int>( | |
| 61 mojo_handle.get().handle, | 59 mojo_handle.get().handle, |
| 62 kMojoIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); | 60 kMojoIPCChannel + base::GlobalDescriptors::kBaseDescriptor)); |
| 63 | 61 |
| 64 options.fds_to_remap = &fds_to_map; | |
| 65 return base::LaunchProcess(cl.argv(), options); | 62 return base::LaunchProcess(cl.argv(), options); |
| 66 } | 63 } |
| 67 | 64 |
| 68 } // namespace | 65 } // namespace |
| 69 | 66 |
| 70 //----------------------- Server -------------------- | 67 //----------------------- Server -------------------- |
| 71 | 68 |
| 72 // Class to communicate on the server side of the IPC Channel. | 69 // Class to communicate on the server side of the IPC Channel. |
| 73 // Method calls are sent over IPC and replies are read back into class | 70 // Method calls are sent over IPC and replies are read back into class |
| 74 // variables. | 71 // variables. |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 std::unique_ptr<IPC::Channel> channel = | 291 std::unique_ptr<IPC::Channel> channel = |
| 295 IPC::Channel::CreateClient(mojo_handle.release(), &listener); | 292 IPC::Channel::CreateClient(mojo_handle.release(), &listener); |
| 296 CHECK(channel->Connect()); | 293 CHECK(channel->Connect()); |
| 297 listener.SetSender(channel.get()); | 294 listener.SetSender(channel.get()); |
| 298 | 295 |
| 299 // run message loop | 296 // run message loop |
| 300 base::RunLoop().Run(); | 297 base::RunLoop().Run(); |
| 301 | 298 |
| 302 return 0; | 299 return 0; |
| 303 } | 300 } |
| OLD | NEW |