| Index: base/test/multiprocess_test_android.cc
|
| diff --git a/base/test/multiprocess_test_android.cc b/base/test/multiprocess_test_android.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..76f2def7d5d6b928331af5d849e98e28a47da8b3
|
| --- /dev/null
|
| +++ b/base/test/multiprocess_test_android.cc
|
| @@ -0,0 +1,39 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "base/test/multiprocess_test.h"
|
| +
|
| +#include <unistd.h>
|
| +
|
| +#include "base/logging.h"
|
| +#include "base/process.h"
|
| +#include "testing/multiprocess_func_list.h"
|
| +
|
| +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).
|
| +// - File descriptors are not closed and hence |fds_to_map| is ignored.
|
| +// - |debug_on_start| is ignored.
|
| +ProcessHandle MultiProcessTest::SpawnChildImpl(
|
| + const std::string& procname,
|
| + const FileHandleMappingVector& fds_to_map,
|
| + bool debug_on_start) {
|
| + pid_t pid = fork();
|
| +
|
| + if (pid < 0) {
|
| + DPLOG(ERROR) << "fork";
|
| + return kNullProcessHandle;
|
| + } else if (pid == 0) {
|
| + // Child process
|
| + int ret = multi_process_function_list::InvokeChildProcessTest(procname);
|
| + _exit(ret);
|
| + }
|
| +
|
| + // Parent process
|
| + return pid;
|
| +}
|
| +
|
| +} // namespace base
|
|
|