Chromium Code Reviews| Index: base/test/multiprocess_test_android.cc |
| diff --git a/base/test/multiprocess_test_android.cc b/base/test/multiprocess_test_android.cc |
| index 51c2ce020d09e50e3352a8609d74462f1c4969fd..3e2872f4f6a8d6452bb5cc88246609b7e70bdfb5 100644 |
| --- a/base/test/multiprocess_test_android.cc |
| +++ b/base/test/multiprocess_test_android.cc |
| @@ -12,14 +12,21 @@ |
| namespace base { |
| -// A very basic implementation for android. On Android tests can run in an APK |
| +// A very basic implementation for Android. On Android tests can run in an APK |
| // and we don't have an executable to exec*. This implementation does the bare |
| // minimum to execute the method specified by procname (in the child process). |
| +// - All options except |fds_to_remap| are ignored. |
| // - |debug_on_start| is ignored. |
| -ProcessHandle MultiProcessTest::SpawnChildImpl( |
| +ProcessHandle MultiProcessTest::SpawnChildWithOptions( |
| const std::string& procname, |
| - const FileHandleMappingVector& fds_to_remap, |
| + const LaunchOptions& options, |
| bool debug_on_start) { |
| + // TODO(vtl): The FD-remapping done below is wrong (e.g., for fd1 -> fd2, fd2 |
|
brettw
2013/12/06 20:40:05
Can you clarify this a bit? Like "...done below is
viettrungluu
2013/12/06 21:23:09
Done.
|
| + // -> fd1). crbug.com/326576 |
| + FileHandleMappingVector empty; |
| + const FileHandleMappingVector* fds_to_remap = |
| + options.fds_to_remap ? options.fds_to_remap : ∅ |
| + |
| pid_t pid = fork(); |
| if (pid < 0) { |
| @@ -32,8 +39,8 @@ ProcessHandle MultiProcessTest::SpawnChildImpl( |
| } |
| // Child process. |
| std::hash_set<int> fds_to_keep_open; |
| - for (FileHandleMappingVector::const_iterator it = fds_to_remap.begin(); |
| - it != fds_to_remap.end(); ++it) { |
| + for (FileHandleMappingVector::const_iterator it = fds_to_remap->begin(); |
| + it != fds_to_remap->end(); ++it) { |
| fds_to_keep_open.insert(it->first); |
| } |
| // Keep stdin, stdout and stderr open since this is not meant to spawn a |
| @@ -44,8 +51,8 @@ ProcessHandle MultiProcessTest::SpawnChildImpl( |
| close(fd); |
| } |
| } |
| - for (FileHandleMappingVector::const_iterator it = fds_to_remap.begin(); |
| - it != fds_to_remap.end(); ++it) { |
| + for (FileHandleMappingVector::const_iterator it = fds_to_remap->begin(); |
| + it != fds_to_remap->end(); ++it) { |
| int old_fd = it->first; |
| int new_fd = it->second; |
| if (dup2(old_fd, new_fd) < 0) { |