OLD | NEW |
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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/message_loop/message_loop.h" | |
18 #include "base/run_loop.h" | |
19 #include "base/task_runner.h" | |
20 #include "base/thread_task_runner_handle.h" | |
21 #include "mojo/edk/embedder/embedder.h" | 17 #include "mojo/edk/embedder/embedder.h" |
22 #include "mojo/edk/test/multiprocess_test_helper.h" | 18 #include "mojo/edk/test/multiprocess_test_helper.h" |
23 #include "mojo/public/c/system/types.h" | 19 #include "mojo/public/c/system/types.h" |
24 #include "mojo/public/cpp/system/message_pipe.h" | 20 #include "mojo/public/cpp/system/message_pipe.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
26 | 22 |
27 namespace mojo { | 23 namespace mojo { |
28 namespace edk { | 24 namespace edk { |
29 namespace test { | 25 namespace test { |
30 | 26 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 const base::StringPiece& s); | 123 const base::StringPiece& s); |
128 | 124 |
129 // Maps a buffer, tests the value of some of its contents, and unmaps it. | 125 // Maps a buffer, tests the value of some of its contents, and unmaps it. |
130 static void ExpectBufferContents(MojoHandle h, | 126 static void ExpectBufferContents(MojoHandle h, |
131 size_t offset, | 127 size_t offset, |
132 const base::StringPiece& s); | 128 const base::StringPiece& s); |
133 | 129 |
134 private: | 130 private: |
135 friend class ClientController; | 131 friend class ClientController; |
136 | 132 |
137 base::MessageLoop message_loop_; | |
138 std::vector<scoped_ptr<ClientController>> clients_; | 133 std::vector<scoped_ptr<ClientController>> clients_; |
139 | 134 |
140 DISALLOW_COPY_AND_ASSIGN(MojoTestBase); | 135 DISALLOW_COPY_AND_ASSIGN(MojoTestBase); |
141 }; | 136 }; |
142 | 137 |
143 // Launches a new child process running the test client |client_name| connected | 138 // Launches a new child process running the test client |client_name| connected |
144 // to a new message pipe bound to |pipe_name|. |pipe_name| is automatically | 139 // to a new message pipe bound to |pipe_name|. |pipe_name| is automatically |
145 // closed on test teardown. | 140 // closed on test teardown. |
146 #define RUN_CHILD_ON_PIPE(client_name, pipe_name) \ | 141 #define RUN_CHILD_ON_PIPE(client_name, pipe_name) \ |
147 StartClientWithHandler( \ | 142 StartClientWithHandler( \ |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 #else // !defined(OS_IOS) | 204 #else // !defined(OS_IOS) |
210 #define DEFINE_TEST_CLIENT_WITH_PIPE(client_name, test_base, pipe_name) | 205 #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) | 206 #define DEFINE_TEST_CLIENT_TEST_WITH_PIPE(client_name, test_base, pipe_name) |
212 #endif // !defined(OS_IOS) | 207 #endif // !defined(OS_IOS) |
213 | 208 |
214 } // namespace test | 209 } // namespace test |
215 } // namespace edk | 210 } // namespace edk |
216 } // namespace mojo | 211 } // namespace mojo |
217 | 212 |
218 #endif // MOJO_EDK_TEST_MOJO_TEST_BASE_H_ | 213 #endif // MOJO_EDK_TEST_MOJO_TEST_BASE_H_ |
OLD | NEW |