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

Side by Side Diff: mojo/edk/test/mojo_test_base.h

Issue 1676913002: [mojo] Delete third_party/mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: let's try that again Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « mojo/edk/test/BUILD.gn ('k') | mojo/edk/test/mojo_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_MOJO_TEST_BASE_H_ 5 #ifndef MOJO_EDK_TEST_MOJO_TEST_BASE_H_
6 #define MOJO_EDK_TEST_MOJO_TEST_BASE_H_ 6 #define MOJO_EDK_TEST_MOJO_TEST_BASE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 ~ClientController(); 42 ~ClientController();
43 43
44 MojoHandle pipe() const { return pipe_.get().value(); } 44 MojoHandle pipe() const { return pipe_.get().value(); }
45 45
46 int WaitForShutdown(); 46 int WaitForShutdown();
47 47
48 private: 48 private:
49 friend class MojoTestBase; 49 friend class MojoTestBase;
50 50
51 MojoTestBase* test_; 51 MojoTestBase* test_;
52 #if !defined(OS_IOS)
52 MultiprocessTestHelper helper_; 53 MultiprocessTestHelper helper_;
54 #endif
53 ScopedMessagePipeHandle pipe_; 55 ScopedMessagePipeHandle pipe_;
54 bool was_shutdown_ = false; 56 bool was_shutdown_ = false;
55 57
56 DISALLOW_COPY_AND_ASSIGN(ClientController); 58 DISALLOW_COPY_AND_ASSIGN(ClientController);
57 }; 59 };
58 60
59 ClientController& StartClient(const std::string& client_name); 61 ClientController& StartClient(const std::string& client_name);
60 62
61 template <typename HandlerFunc> 63 template <typename HandlerFunc>
62 void StartClientWithHandler(const std::string& client_name, 64 void StartClientWithHandler(const std::string& client_name,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // MojoTestBase and MultiprocessTestHelper. It returns an |int|, which will 164 // MojoTestBase and MultiprocessTestHelper. It returns an |int|, which will
163 // will be the process's exit code (but see the comment about 165 // will be the process's exit code (but see the comment about
164 // WaitForChildShutdown()). 166 // WaitForChildShutdown()).
165 // 167 //
166 // The function is defined as a subclass of |test_base| to facilitate shared 168 // The function is defined as a subclass of |test_base| to facilitate shared
167 // code between test clients and to allow clients to spawn children themselves. 169 // code between test clients and to allow clients to spawn children themselves.
168 // 170 //
169 // |pipe_name| will be bound to the MojoHandle of a message pipe connected 171 // |pipe_name| will be bound to the MojoHandle of a message pipe connected
170 // to the parent process (see RUN_CHILD_ON_PIPE above.) This pipe handle is 172 // to the parent process (see RUN_CHILD_ON_PIPE above.) This pipe handle is
171 // automatically closed on test client teardown. 173 // automatically closed on test client teardown.
174 #if !defined(OS_IOS)
172 #define DEFINE_TEST_CLIENT_WITH_PIPE(client_name, test_base, pipe_name) \ 175 #define DEFINE_TEST_CLIENT_WITH_PIPE(client_name, test_base, pipe_name) \
173 class client_name##_MainFixture : public test_base { \ 176 class client_name##_MainFixture : public test_base { \
174 void TestBody() override {} \ 177 void TestBody() override {} \
175 public: \ 178 public: \
176 int Main(MojoHandle); \ 179 int Main(MojoHandle); \
177 }; \ 180 }; \
178 MULTIPROCESS_TEST_MAIN_WITH_SETUP( \ 181 MULTIPROCESS_TEST_MAIN_WITH_SETUP( \
179 client_name##TestChildMain, \ 182 client_name##TestChildMain, \
180 test::MultiprocessTestHelper::ChildSetup) { \ 183 test::MultiprocessTestHelper::ChildSetup) { \
181 client_name##_MainFixture test; \ 184 client_name##_MainFixture test; \
(...skipping 14 matching lines...) Expand all
196 }; \ 199 }; \
197 MULTIPROCESS_TEST_MAIN_WITH_SETUP( \ 200 MULTIPROCESS_TEST_MAIN_WITH_SETUP( \
198 client_name##TestChildMain, \ 201 client_name##TestChildMain, \
199 test::MultiprocessTestHelper::ChildSetup) { \ 202 test::MultiprocessTestHelper::ChildSetup) { \
200 client_name##_MainFixture test; \ 203 client_name##_MainFixture test; \
201 return test::MultiprocessTestHelper::RunClientTestMain( \ 204 return test::MultiprocessTestHelper::RunClientTestMain( \
202 base::Bind(&client_name##_MainFixture::Main, \ 205 base::Bind(&client_name##_MainFixture::Main, \
203 base::Unretained(&test))); \ 206 base::Unretained(&test))); \
204 } \ 207 } \
205 void client_name##_MainFixture::Main(MojoHandle pipe_name) 208 void client_name##_MainFixture::Main(MojoHandle pipe_name)
206 209 #else // !defined(OS_IOS)
207 210 #define DEFINE_TEST_CLIENT_WITH_PIPE(client_name, test_base, pipe_name)
211 #define DEFINE_TEST_CLIENT_TEST_WITH_PIPE(client_name, test_base, pipe_name)
212 #endif // !defined(OS_IOS)
208 213
209 } // namespace test 214 } // namespace test
210 } // namespace edk 215 } // namespace edk
211 } // namespace mojo 216 } // namespace mojo
212 217
213 #endif // MOJO_EDK_TEST_MOJO_TEST_BASE_H_ 218 #endif // MOJO_EDK_TEST_MOJO_TEST_BASE_H_
OLDNEW
« no previous file with comments | « mojo/edk/test/BUILD.gn ('k') | mojo/edk/test/mojo_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698