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

Unified Diff: base/process/process_util_unittest.cc

Issue 2950153002: Improve process launch handle sharing API. (Closed)
Patch Set: Fix Mojo launcher, review comments Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: base/process/process_util_unittest.cc
diff --git a/base/process/process_util_unittest.cc b/base/process/process_util_unittest.cc
index f99d843f62ec293c72a4bba9e81abb50f951e0c5..989f61d63cce8c6d7ae2c44a52505e33cb9dc403 100644
--- a/base/process/process_util_unittest.cc
+++ b/base/process/process_util_unittest.cc
@@ -484,10 +484,8 @@ TEST_F(ProcessUtilTest, InheritSpecifiedHandles) {
// Takes ownership of the event handle.
base::WaitableEvent event(base::win::ScopedHandle(
CreateEvent(&security_attributes, true, false, NULL)));
- base::HandlesToInheritVector handles_to_inherit;
- handles_to_inherit.push_back(event.handle());
base::LaunchOptions options;
- options.handles_to_inherit = &handles_to_inherit;
+ options.handles_to_inherit.push_back(event.handle());
base::CommandLine cmd_line = MakeCmdLine("TriggerEventChildProcess");
cmd_line.AppendSwitchASCII(
@@ -631,10 +629,8 @@ int ProcessUtilTest::CountOpenFDsInChild() {
if (pipe(fds) < 0)
NOTREACHED();
- base::FileHandleMappingVector fd_mapping_vec;
- fd_mapping_vec.push_back(std::pair<int, int>(fds[1], kChildPipe));
base::LaunchOptions options;
- options.fds_to_remap = &fd_mapping_vec;
+ options.fds_to_remap.push_back(std::pair<int, int>(fds[1], kChildPipe));
base::SpawnChildResult spawn_child =
SpawnChildWithOptions("ProcessUtilsLeakFDChildProcess", options);
CHECK(spawn_child.process.IsValid());
@@ -698,17 +694,14 @@ std::string TestLaunchProcess(const std::vector<std::string>& args,
const base::EnvironmentMap& env_changes,
const bool clear_environ,
const int clone_flags) {
- base::FileHandleMappingVector fds_to_remap;
-
int fds[2];
PCHECK(pipe(fds) == 0);
- fds_to_remap.push_back(std::make_pair(fds[1], 1));
base::LaunchOptions options;
options.wait = true;
options.environ = env_changes;
options.clear_environ = clear_environ;
- options.fds_to_remap = &fds_to_remap;
+ options.fds_to_remap.push_back(std::make_pair(fds[1], 1));
#if defined(OS_LINUX)
options.clone_flags = clone_flags;
#else
@@ -952,12 +945,10 @@ TEST_F(ProcessUtilTest, PreExecHook) {
base::ScopedFD read_fd(pipe_fds[0]);
base::ScopedFD write_fd(pipe_fds[1]);
- base::FileHandleMappingVector fds_to_remap;
- fds_to_remap.push_back(std::make_pair(read_fd.get(), read_fd.get()));
ReadFromPipeDelegate read_from_pipe_delegate(read_fd.get());
base::LaunchOptions options;
- options.fds_to_remap = &fds_to_remap;
+ options.fds_to_remap.push_back(std::make_pair(read_fd.get(), read_fd.get()));
options.pre_exec_delegate = &read_from_pipe_delegate;
base::SpawnChildResult spawn_child =
SpawnChildWithOptions("SimpleChildProcess", options);

Powered by Google App Engine
This is Rietveld 408576698