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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ 5 #ifndef MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_
6 #define MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ 6 #define MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/process/process_handle.h" 11 #include "base/process/process_handle.h"
12 #include "base/test/multiprocess_test.h" 12 #include "base/test/multiprocess_test.h"
13 #include "base/test/test_timeouts.h" 13 #include "base/test/test_timeouts.h"
14 #include "mojo/edk/embedder/scoped_platform_handle.h" 14 #include "mojo/edk/embedder/scoped_platform_handle.h"
15 #include "mojo/edk/embedder/test_embedder.h"
15 #include "testing/multiprocess_func_list.h" 16 #include "testing/multiprocess_func_list.h"
16 17
17 namespace mojo { 18 namespace mojo {
18 19
19 namespace embedder { 20 namespace embedder {
20 class PlatformChannelPair; 21 class PlatformChannelPair;
21 } 22 }
22 23
23 namespace test { 24 namespace test {
24 25
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // exit code (but see the comment about |WaitForChildShutdown()|). 69 // exit code (but see the comment about |WaitForChildShutdown()|).
69 #define MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) \ 70 #define MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) \
70 MULTIPROCESS_TEST_MAIN_WITH_SETUP( \ 71 MULTIPROCESS_TEST_MAIN_WITH_SETUP( \
71 test_child_name##TestChildMain, \ 72 test_child_name##TestChildMain, \
72 ::mojo::test::MultiprocessTestHelper::ChildSetup) 73 ::mojo::test::MultiprocessTestHelper::ChildSetup)
73 74
74 // Use this (and |WaitForChildTestShutdown()|) for the child process's "main()", 75 // Use this (and |WaitForChildTestShutdown()|) for the child process's "main()",
75 // if you want to use |EXPECT_...()| or |ASSERT_...()|; it has a |void| return 76 // if you want to use |EXPECT_...()| or |ASSERT_...()|; it has a |void| return
76 // type. (Note that while an |ASSERT_...()| failure will abort the test in the 77 // type. (Note that while an |ASSERT_...()| failure will abort the test in the
77 // child, it will not abort the test in the parent.) 78 // child, it will not abort the test in the parent.)
79 // On android, multiprocess cannot exec, so the embedder must be shut down.
78 #define MOJO_MULTIPROCESS_TEST_CHILD_TEST(test_child_name) \ 80 #define MOJO_MULTIPROCESS_TEST_CHILD_TEST(test_child_name) \
79 void test_child_name##TestChildTest(); \ 81 void test_child_name##TestChildTest(); \
80 MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) { \ 82 MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) { \
83 if (embedder::test::IsInitialized()) \
84 embedder::test::Shutdown(); \
81 test_child_name##TestChildTest(); \ 85 test_child_name##TestChildTest(); \
82 return (::testing::Test::HasFatalFailure() || \ 86 return (::testing::Test::HasFatalFailure() || \
83 ::testing::Test::HasNonfatalFailure()) \ 87 ::testing::Test::HasNonfatalFailure()) \
84 ? 1 \ 88 ? 1 \
85 : 0; \ 89 : 0; \
86 } \ 90 } \
87 void test_child_name##TestChildTest() 91 void test_child_name##TestChildTest()
88 92
89 } // namespace test 93 } // namespace test
90 } // namespace mojo 94 } // namespace mojo
91 95
92 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_ 96 #endif // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698