OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 IPC_IPC_TESTS_H_ | 5 #ifndef IPC_IPC_TEST_BASE_H_ |
6 #define IPC_IPC_TESTS_H_ | 6 #define IPC_IPC_TEST_BASE_H_ |
7 | 7 |
| 8 #include "base/process.h" |
8 #include "base/test/multiprocess_test.h" | 9 #include "base/test/multiprocess_test.h" |
9 #include "base/process.h" | |
10 | |
11 // This unit test uses 3 types of child processes, a regular pipe client, | |
12 // a client reflector and a IPC server used for fuzzing tests. | |
13 enum ChildType { | |
14 TEST_CLIENT, | |
15 TEST_DESCRIPTOR_CLIENT, | |
16 TEST_DESCRIPTOR_CLIENT_SANDBOXED, | |
17 TEST_REFLECTOR, | |
18 FUZZER_SERVER, | |
19 SYNC_SOCKET_SERVER | |
20 }; | |
21 | 10 |
22 // The different channel names for the child processes. | 11 // The different channel names for the child processes. |
23 extern const char kTestClientChannel[]; | 12 extern const char kTestClientChannel[]; |
24 extern const char kReflectorChannel[]; | 13 extern const char kReflectorChannel[]; |
25 extern const char kFuzzerChannel[]; | 14 extern const char kFuzzerChannel[]; |
26 extern const char kSyncSocketChannel[]; | 15 extern const char kSyncSocketChannel[]; |
27 | 16 |
28 class MessageLoopForIO; | 17 class MessageLoopForIO; |
29 namespace IPC { | 18 namespace IPC { |
30 class Channel; | 19 class Channel; |
31 } // namespace IPC | 20 } // namespace IPC |
32 | 21 |
33 //Base class to facilitate Spawning IPC Client processes. | 22 // Base class to facilitate spawning IPC client processes. |
34 class IPCChannelTest : public base::MultiProcessTest { | 23 class IPCTestBase : public base::MultiProcessTest { |
| 24 public: |
| 25 enum ChildType { |
| 26 TEST_CLIENT, |
| 27 TEST_DESCRIPTOR_CLIENT, |
| 28 TEST_DESCRIPTOR_CLIENT_SANDBOXED, |
| 29 TEST_REFLECTOR, |
| 30 FUZZER_SERVER, |
| 31 SYNC_SOCKET_SERVER |
| 32 }; |
| 33 |
35 protected: | 34 protected: |
36 | 35 // Create a new MessageLoopForIO for each test. |
37 // Create a new MessageLoopForIO For each test. | |
38 virtual void SetUp() OVERRIDE; | 36 virtual void SetUp() OVERRIDE; |
39 virtual void TearDown() OVERRIDE; | 37 virtual void TearDown() OVERRIDE; |
40 | 38 |
41 // Spawns a child process of the specified type | 39 // Spawns a child process of the specified type |
42 base::ProcessHandle SpawnChild(ChildType child_type, IPC::Channel* channel); | 40 base::ProcessHandle SpawnChild(ChildType child_type, IPC::Channel* channel); |
43 | 41 |
44 // Created around each test instantiation. | 42 // Created around each test instantiation. |
45 MessageLoopForIO* message_loop_; | 43 MessageLoopForIO* message_loop_; |
46 }; | 44 }; |
47 | 45 |
48 #endif // IPC_IPC_TESTS_H_ | 46 #endif // IPC_IPC_TEST_BASE_H_ |
OLD | NEW |