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

Unified Diff: base/test/multiprocess_test.h

Issue 2611323002: Relanding "Multiprocess test client: Android child process launcher rework." (Closed)
Patch Set: Addressed nyquist@'s comment + sync Created 3 years, 11 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
Index: base/test/multiprocess_test.h
diff --git a/base/test/multiprocess_test.h b/base/test/multiprocess_test.h
index ae4c3eb2ef75df8c33592456d7cfbcac80ea74ea..bf9663759e05bb0136a32f99f9ad5c8f5f50c4ad 100644
--- a/base/test/multiprocess_test.h
+++ b/base/test/multiprocess_test.h
@@ -40,7 +40,7 @@ class CommandLine;
// // Do stuff involving |test_child_process| and the child process....
//
// int rv = -1;
-// ASSERT_TRUE(test_child_process.WaitForExitWithTimeout(
+// ASSERT_TRUE(base::WaitForMultiprocessTestChildExit(test_child_process,
// TestTimeouts::action_timeout(), &rv));
// EXPECT_EQ(0, rv);
// }
@@ -51,6 +51,10 @@ class CommandLine;
// // Code here runs in a child process....
// return 0;
// }
+//
+// If you need to terminate the child process, use the
+// TerminateMultiProcessTestChild method to ensure that test will work on
+// Android.
// Spawns a child process and executes the function |procname| declared using
// |MULTIPROCESS_TEST_MAIN()| or |MULTIPROCESS_TEST_MAIN_WITH_SETUP()|.
@@ -66,24 +70,17 @@ Process SpawnMultiProcessTestChild(
// may add any flags needed for your child process.
CommandLine GetMultiProcessTestChildBaseCommandLine();
-#if defined(OS_ANDROID)
-
-// Enable the alternate test child implementation which support spawning a child
-// after threads have been created. If used, this MUST be the first line of
-// main(). The main function is passed in to avoid a link-time dependency in
-// component builds.
-void InitAndroidMultiProcessTestHelper(int (*main)(int, char**));
-
-// Returns true if the current process is a test child.
-bool AndroidIsChildProcess();
-
-// Wait for a test child to exit if the alternate test child implementation is
-// being used.
-bool AndroidWaitForChildExitWithTimeout(
- const Process& process, TimeDelta timeout, int* exit_code)
- WARN_UNUSED_RESULT;
-
-#endif // defined(OS_ANDROID)
+// Waits for the child process to exit. Returns true if the process exited
+// within |timeout| and sets |exit_code| if non null.
+bool WaitForMultiprocessTestChildExit(const Process& process,
+ TimeDelta timeout,
+ int* exit_code);
+
+// Terminates |process| with |exit_code|. If |wait| is true, this call blocks
+// until the process actually terminates.
+bool TerminateMultiProcessTestChild(const Process& process,
+ int exit_code,
+ bool wait);
// MultiProcessTest ------------------------------------------------------------
« no previous file with comments | « base/test/android/java/src/org/chromium/base/MultiprocessTestClientService4.java ('k') | base/test/multiprocess_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698