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

Unified Diff: base/process/process_util_unittest.cc

Issue 2950153002: Improve process launch handle sharing API. (Closed)
Patch Set: Merge 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
« no previous file with comments | « base/process/launch_win.cc ('k') | base/test/launcher/test_launcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_util_unittest.cc
diff --git a/base/process/process_util_unittest.cc b/base/process/process_util_unittest.cc
index 12f3baf27e3910f8687a9bfddfa966685f7cc9d6..6422cf41211c9999976e746b75a0919a0e7ce2f4 100644
--- a/base/process/process_util_unittest.cc
+++ b/base/process/process_util_unittest.cc
@@ -483,10 +483,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(
@@ -623,10 +621,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());
@@ -690,17 +686,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
@@ -944,12 +937,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);
« no previous file with comments | « base/process/launch_win.cc ('k') | base/test/launcher/test_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698