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

Unified Diff: mojo/edk/test/multiprocess_test_helper.h

Issue 728783003: Add infrastructure to run tests on android. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Do not introduce IsInitialzed() Created 6 years, 1 month 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: mojo/edk/test/multiprocess_test_helper.h
diff --git a/mojo/edk/test/multiprocess_test_helper.h b/mojo/edk/test/multiprocess_test_helper.h
index d131460228aaf69494c9fa3ed23b67cd24a11392..1da71602637bb4d4f8de821af078f0f0063449e7 100644
--- a/mojo/edk/test/multiprocess_test_helper.h
+++ b/mojo/edk/test/multiprocess_test_helper.h
@@ -12,6 +12,7 @@
#include "base/test/multiprocess_test.h"
#include "base/test/test_timeouts.h"
#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/embedder/test_embedder.h"
#include "testing/multiprocess_func_list.h"
namespace mojo {
@@ -71,6 +72,17 @@ class MultiprocessTestHelper {
test_child_name##TestChildMain, \
::mojo::test::MultiprocessTestHelper::ChildSetup)
+// On android, multi-process tests cannot call exec. It means that the test must
viettrungluu 2014/11/17 23:56:58 In general, executing in a forked but not-exec-ed
qsr 2014/11/18 09:55:27 Not without a lot of infrastructure work. There
+// shutdown the embedder on the forked process as it expects to be in a clean
+// state.
+#if defined(OS_ANDROID)
+#define SHUTDOWN_EMBEDDER_ON_ANDROID() embedder::test::Shutdown()
+#else
+#define SHUTDOWN_EMBEDDER_ON_ANDROID() \
+ do { \
+ } while (0)
+#endif
+
// Use this (and |WaitForChildTestShutdown()|) for the child process's "main()",
// if you want to use |EXPECT_...()| or |ASSERT_...()|; it has a |void| return
// type. (Note that while an |ASSERT_...()| failure will abort the test in the
@@ -78,6 +90,7 @@ class MultiprocessTestHelper {
#define MOJO_MULTIPROCESS_TEST_CHILD_TEST(test_child_name) \
void test_child_name##TestChildTest(); \
MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) { \
+ SHUTDOWN_EMBEDDER_ON_ANDROID(); \
test_child_name##TestChildTest(); \
return (::testing::Test::HasFatalFailure() || \
::testing::Test::HasNonfatalFailure()) \

Powered by Google App Engine
This is Rietveld 408576698