Index: base/test/multiprocess_test_android.cc |
diff --git a/base/test/multiprocess_test_android.cc b/base/test/multiprocess_test_android.cc |
index 4cfae5ecaacd51449e018018b2b9579de09d50bc..8f54b82b5ea4512bf15c4e3b21116e495a7783cb 100644 |
--- a/base/test/multiprocess_test_android.cc |
+++ b/base/test/multiprocess_test_android.cc |
@@ -2,13 +2,15 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "base/posix/global_descriptors.h" |
#include "base/test/multiprocess_test.h" |
#include <unistd.h> |
+#include "base/base_switches.h" |
+#include "base/command_line.h" |
#include "base/containers/hash_tables.h" |
#include "base/logging.h" |
+#include "base/posix/global_descriptors.h" |
#include "testing/multiprocess_func_list.h" |
namespace base { |
@@ -16,7 +18,6 @@ namespace base { |
// 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). |
-// - |base_command_line| is ignored. |
// - All options except |fds_to_remap| are ignored. |
ProcessHandle SpawnMultiProcessTestChild(const std::string& procname, |
const CommandLine& base_command_line, |
@@ -60,6 +61,13 @@ ProcessHandle SpawnMultiProcessTestChild(const std::string& procname, |
} |
close(old_fd); |
} |
+ CommandLine::Reset(); |
+ CommandLine::Init(0, nullptr); |
+ CommandLine* command_line = CommandLine::ForCurrentProcess(); |
+ command_line->InitFromArgv(base_command_line.argv()); |
+ if (!command_line->HasSwitch(switches::kTestChildProcess)) |
+ command_line->AppendSwitchASCII(switches::kTestChildProcess, procname); |
+ |
_exit(multi_process_function_list::InvokeChildProcessTest(procname)); |
return 0; |
} |