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

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

Issue 22750002: Move AlterEnvironment to base/environment.h, implement on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win Created 7 years, 3 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') | chromeos/process_proxy/process_proxy.cc » ('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"
(...skipping 25 matching lines...) Expand all
36 // |handle| - On return, the process handle to use to communicate with the 36 // |handle| - On return, the process handle to use to communicate with the
37 // child. 37 // child.
38 bool LaunchNSSDecrypterChildProcess(const base::FilePath& nss_path, 38 bool LaunchNSSDecrypterChildProcess(const base::FilePath& nss_path,
39 IPC::Channel* channel, base::ProcessHandle* handle) { 39 IPC::Channel* channel, base::ProcessHandle* handle) {
40 CommandLine cl(*CommandLine::ForCurrentProcess()); 40 CommandLine cl(*CommandLine::ForCurrentProcess());
41 cl.AppendSwitchASCII(switches::kTestChildProcess, "NSSDecrypterChildProcess"); 41 cl.AppendSwitchASCII(switches::kTestChildProcess, "NSSDecrypterChildProcess");
42 42
43 // Set env variable needed for FF encryption libs to load. 43 // Set env variable needed for FF encryption libs to load.
44 // See "chrome/utility/importer/nss_decryptor_mac.mm" for an explanation of 44 // See "chrome/utility/importer/nss_decryptor_mac.mm" for an explanation of
45 // why we need this. 45 // why we need this.
46 base::EnvironmentVector env; 46 base::LaunchOptions options;
47 std::pair<std::string, std::string> dyld_override; 47 options.environ["DYLD_FALLBACK_LIBRARY_PATH"] = nss_path.value();
48 dyld_override.first = "DYLD_FALLBACK_LIBRARY_PATH";
49 dyld_override.second = nss_path.value();
50 env.push_back(dyld_override);
51 48
52 int ipcfd = channel->TakeClientFileDescriptor(); 49 int ipcfd = channel->TakeClientFileDescriptor();
53 if (ipcfd == -1) 50 if (ipcfd == -1)
54 return false; 51 return false;
55 52
56 file_util::ScopedFD client_file_descriptor_closer(&ipcfd); 53 file_util::ScopedFD client_file_descriptor_closer(&ipcfd);
57 base::FileHandleMappingVector fds_to_map; 54 base::FileHandleMappingVector fds_to_map;
58 fds_to_map.push_back(std::pair<int,int>(ipcfd, kPrimaryIPCChannel + 3)); 55 fds_to_map.push_back(std::pair<int,int>(ipcfd, kPrimaryIPCChannel + 3));
59 56
60 bool debug_on_start = CommandLine::ForCurrentProcess()->HasSwitch( 57 bool debug_on_start = CommandLine::ForCurrentProcess()->HasSwitch(
61 switches::kDebugChildren); 58 switches::kDebugChildren);
62 base::LaunchOptions options;
63 options.environ = &env;
64 options.fds_to_remap = &fds_to_map; 59 options.fds_to_remap = &fds_to_map;
65 options.wait = debug_on_start; 60 options.wait = debug_on_start;
66 return base::LaunchProcess(cl.argv(), options, handle); 61 return base::LaunchProcess(cl.argv(), options, handle);
67 } 62 }
68 63
69 } // namespace 64 } // namespace
70 65
71 //----------------------- Server -------------------- 66 //----------------------- Server --------------------
72 67
73 // Class to communicate on the server side of the IPC Channel. 68 // Class to communicate on the server side of the IPC Channel.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 268
274 IPC::Channel channel(kTestChannelID, IPC::Channel::MODE_CLIENT, &listener); 269 IPC::Channel channel(kTestChannelID, IPC::Channel::MODE_CLIENT, &listener);
275 CHECK(channel.Connect()); 270 CHECK(channel.Connect());
276 listener.SetSender(&channel); 271 listener.SetSender(&channel);
277 272
278 // run message loop 273 // run message loop
279 base::MessageLoop::current()->Run(); 274 base::MessageLoop::current()->Run();
280 275
281 return 0; 276 return 0;
282 } 277 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/chrome_launcher.cc ('k') | chromeos/process_proxy/process_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698