| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/test/multiprocess_test.h" |
| 6 |
| 7 #include <unistd.h> |
| 8 |
| 9 #include "base/logging.h" |
| 10 #include "base/process.h" |
| 11 #include "testing/multiprocess_func_list.h" |
| 12 |
| 13 namespace base { |
| 14 |
| 15 // A very basic implementation for android. On Android tests can run in an APK |
| 16 // and we don't have an executable to exec*. This implementation does the bare |
| 17 // minimum to execute the method specified by procname (in the child process). |
| 18 // - File descriptors are not closed and hence |fds_to_map| is ignored. |
| 19 // - |debug_on_start| is ignored. |
| 20 ProcessHandle MultiProcessTest::SpawnChildImpl( |
| 21 const std::string& procname, |
| 22 const FileHandleMappingVector& fds_to_map, |
| 23 bool debug_on_start) { |
| 24 pid_t pid = fork(); |
| 25 |
| 26 if (pid < 0) { |
| 27 DPLOG(ERROR) << "fork"; |
| 28 return kNullProcessHandle; |
| 29 } else if (pid == 0) { |
| 30 // Child process. |
| 31 _exit(multi_process_function_list::InvokeChildProcessTest(procname)); |
| 32 } |
| 33 |
| 34 // Parent process. |
| 35 return pid; |
| 36 } |
| 37 |
| 38 } // namespace base |
| OLD | NEW |