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/macros.h" | 10 #include "base/macros.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // channel or a proxy). | 99 // channel or a proxy). |
100 IPC::Sender* sender() { | 100 IPC::Sender* sender() { |
101 return channel_.get() ? static_cast<IPC::Sender*>(channel_.get()) : | 101 return channel_.get() ? static_cast<IPC::Sender*>(channel_.get()) : |
102 static_cast<IPC::Sender*>(channel_proxy_.get()); | 102 static_cast<IPC::Sender*>(channel_proxy_.get()); |
103 } | 103 } |
104 | 104 |
105 IPC::Channel* channel() { return channel_.get(); } | 105 IPC::Channel* channel() { return channel_.get(); } |
106 IPC::ChannelProxy* channel_proxy() { return channel_proxy_.get(); } | 106 IPC::ChannelProxy* channel_proxy() { return channel_proxy_.get(); } |
107 | 107 |
108 const base::Process& client_process() const { return client_process_; } | 108 const base::Process& client_process() const { return client_process_; } |
109 scoped_refptr<base::SequencedTaskRunner> task_runner(); | 109 virtual scoped_refptr<base::TaskRunner> io_task_runner(); |
110 | 110 |
111 virtual scoped_ptr<IPC::ChannelFactory> CreateChannelFactory( | 111 virtual scoped_ptr<IPC::ChannelFactory> CreateChannelFactory( |
112 const IPC::ChannelHandle& handle, base::SequencedTaskRunner* runner); | 112 const IPC::ChannelHandle& handle, base::TaskRunner* runner); |
113 | 113 |
| 114 virtual void AboutToSpawnChild(base::LaunchOptions* options) {} |
114 virtual bool DidStartClient(); | 115 virtual bool DidStartClient(); |
115 | 116 |
116 private: | 117 private: |
117 std::string GetTestMainName() const; | 118 std::string GetTestMainName() const; |
118 | 119 |
119 std::string test_client_name_; | 120 std::string test_client_name_; |
120 scoped_ptr<base::MessageLoop> message_loop_; | 121 scoped_ptr<base::MessageLoop> message_loop_; |
121 | 122 |
122 scoped_ptr<IPC::Channel> channel_; | 123 scoped_ptr<IPC::Channel> channel_; |
123 scoped_ptr<IPC::ChannelProxy> channel_proxy_; | 124 scoped_ptr<IPC::ChannelProxy> channel_proxy_; |
124 | 125 |
125 base::Process client_process_; | 126 base::Process client_process_; |
126 | 127 |
127 DISALLOW_COPY_AND_ASSIGN(IPCTestBase); | 128 DISALLOW_COPY_AND_ASSIGN(IPCTestBase); |
128 }; | 129 }; |
129 | 130 |
130 // Use this to declare the client side for tests using IPCTestBase. | 131 // Use this to declare the client side for tests using IPCTestBase. |
131 #define MULTIPROCESS_IPC_TEST_CLIENT_MAIN(test_client_name) \ | 132 #define MULTIPROCESS_IPC_TEST_CLIENT_MAIN(test_client_name) \ |
132 MULTIPROCESS_IPC_TEST_MAIN(test_client_name ## TestClientMain) | 133 MULTIPROCESS_IPC_TEST_MAIN(test_client_name ## TestClientMain) |
133 | 134 |
134 #endif // IPC_IPC_TEST_BASE_H_ | 135 #endif // IPC_IPC_TEST_BASE_H_ |
OLD | NEW |