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

Unified Diff: base/test/multiprocess_test_android.cc

Issue 10408081: Provide android specific implementation for MultiProcessTest::SpawnChildImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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/test/multiprocess_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cc45d0674eb11729d5314aaec1c1a34819c80066
--- /dev/null
+++ b/base/test/multiprocess_test_android.cc
@@ -0,0 +1,38 @@
+// 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.
+ _exit(multi_process_function_list::InvokeChildProcessTest(procname));
+ }
+
+ // Parent process.
+ return pid;
+}
+
+} // namespace base
« no previous file with comments | « base/test/multiprocess_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698