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