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_TEST_BASE_H_ | 5 #ifndef IPC_IPC_TEST_BASE_H_ |
6 #define IPC_IPC_TEST_BASE_H_ | 6 #define IPC_IPC_TEST_BASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 // Use this instead of CreateChannel() if you want to use some different | 55 // Use this instead of CreateChannel() if you want to use some different |
56 // channel specification (then use ConnectChannel() as usual). | 56 // channel specification (then use ConnectChannel() as usual). |
57 void CreateChannelFromChannelHandle(const IPC::ChannelHandle& channel_handle, | 57 void CreateChannelFromChannelHandle(const IPC::ChannelHandle& channel_handle, |
58 IPC::Listener* listener); | 58 IPC::Listener* listener); |
59 | 59 |
60 // Creates a channel proxy with the given listener and task runner. (The | 60 // Creates a channel proxy with the given listener and task runner. (The |
61 // channel proxy will automatically create and connect a channel.) You must | 61 // channel proxy will automatically create and connect a channel.) You must |
62 // (manually) destroy the channel proxy before the task runner's thread is | 62 // (manually) destroy the channel proxy before the task runner's thread is |
63 // destroyed. | 63 // destroyed. |
64 void CreateChannelProxy(IPC::Listener* listener, | 64 void CreateChannelProxy( |
65 base::SingleThreadTaskRunner* ipc_task_runner); | 65 IPC::Listener* listener, |
| 66 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); |
66 void DestroyChannelProxy(); | 67 void DestroyChannelProxy(); |
67 | 68 |
68 // Starts the client process, returning true if successful; this should be | 69 // Starts the client process, returning true if successful; this should be |
69 // done after connecting to the channel. | 70 // done after connecting to the channel. |
70 bool StartClient(); | 71 bool StartClient(); |
71 | 72 |
72 // Waits for the client to shut down, returning true if successful. Note that | 73 // Waits for the client to shut down, returning true if successful. Note that |
73 // this does not initiate client shutdown; that must be done by the test | 74 // this does not initiate client shutdown; that must be done by the test |
74 // (somehow). This must be called before the end of the test whenever | 75 // (somehow). This must be called before the end of the test whenever |
75 // StartClient() was called successfully. | 76 // StartClient() was called successfully. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 base::ProcessHandle client_process_; | 109 base::ProcessHandle client_process_; |
109 | 110 |
110 DISALLOW_COPY_AND_ASSIGN(IPCTestBase); | 111 DISALLOW_COPY_AND_ASSIGN(IPCTestBase); |
111 }; | 112 }; |
112 | 113 |
113 // Use this to declare the client side for tests using IPCTestBase. | 114 // Use this to declare the client side for tests using IPCTestBase. |
114 #define MULTIPROCESS_IPC_TEST_CLIENT_MAIN(test_client_name) \ | 115 #define MULTIPROCESS_IPC_TEST_CLIENT_MAIN(test_client_name) \ |
115 MULTIPROCESS_IPC_TEST_MAIN(test_client_name ## TestClientMain) | 116 MULTIPROCESS_IPC_TEST_MAIN(test_client_name ## TestClientMain) |
116 | 117 |
117 #endif // IPC_IPC_TEST_BASE_H_ | 118 #endif // IPC_IPC_TEST_BASE_H_ |
OLD | NEW |