OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 BLIMP_NET_TEST_COMMON_H_ | 5 #ifndef BLIMP_NET_TEST_COMMON_H_ |
6 #define BLIMP_NET_TEST_COMMON_H_ | 6 #define BLIMP_NET_TEST_COMMON_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "blimp/common/proto/blimp_message.pb.h" | 14 #include "blimp/common/proto/blimp_message.pb.h" |
15 #include "blimp/net/blimp_connection.h" | 15 #include "blimp/net/blimp_connection.h" |
16 #include "blimp/net/blimp_message_processor.h" | 16 #include "blimp/net/blimp_message_processor.h" |
17 #include "blimp/net/blimp_transport.h" | 17 #include "blimp/net/blimp_transport.h" |
18 #include "blimp/net/connection_error_observer.h" | 18 #include "blimp/net/connection_error_observer.h" |
19 #include "blimp/net/connection_handler.h" | 19 #include "blimp/net/connection_handler.h" |
| 20 #include "blimp/net/message_port.h" |
20 #include "blimp/net/packet_reader.h" | 21 #include "blimp/net/packet_reader.h" |
21 #include "blimp/net/packet_writer.h" | 22 #include "blimp/net/packet_writer.h" |
22 #include "net/socket/stream_socket.h" | 23 #include "net/socket/stream_socket.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
24 | 25 |
25 namespace net { | 26 namespace net { |
26 class GrowableIOBuffer; | 27 class GrowableIOBuffer; |
27 } // namespace net | 28 } // namespace net |
28 | 29 |
29 namespace blimp { | 30 namespace blimp { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 MOCK_METHOD1(AddConnectionAttempts, void(const net::ConnectionAttempts&)); | 133 MOCK_METHOD1(AddConnectionAttempts, void(const net::ConnectionAttempts&)); |
133 MOCK_CONST_METHOD0(GetTotalReceivedBytes, int64_t()); | 134 MOCK_CONST_METHOD0(GetTotalReceivedBytes, int64_t()); |
134 }; | 135 }; |
135 | 136 |
136 class MockTransport : public BlimpTransport { | 137 class MockTransport : public BlimpTransport { |
137 public: | 138 public: |
138 MockTransport(); | 139 MockTransport(); |
139 ~MockTransport() override; | 140 ~MockTransport() override; |
140 | 141 |
141 MOCK_METHOD1(Connect, void(const net::CompletionCallback& callback)); | 142 MOCK_METHOD1(Connect, void(const net::CompletionCallback& callback)); |
142 MOCK_METHOD0(TakeConnectionPtr, BlimpConnection*()); | 143 MOCK_METHOD0(TakeMessagePortPtr, MessagePort*()); |
143 | 144 |
144 std::unique_ptr<BlimpConnection> TakeConnection() override; | 145 std::unique_ptr<MessagePort> TakeMessagePort() override; |
145 const char* GetName() const override; | 146 const char* GetName() const override; |
146 }; | 147 }; |
147 | 148 |
148 class MockConnectionHandler : public ConnectionHandler { | 149 class MockConnectionHandler : public ConnectionHandler { |
149 public: | 150 public: |
150 MockConnectionHandler(); | 151 MockConnectionHandler(); |
151 ~MockConnectionHandler() override; | 152 ~MockConnectionHandler() override; |
152 | 153 |
153 MOCK_METHOD1(HandleConnectionPtr, void(BlimpConnection* connection)); | 154 MOCK_METHOD1(HandleConnectionPtr, void(BlimpConnection* connection)); |
154 void HandleConnection(std::unique_ptr<BlimpConnection> connection) override; | 155 void HandleConnection(std::unique_ptr<BlimpConnection> connection) override; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 const net::CompletionCallback& callback) override; | 213 const net::CompletionCallback& callback) override; |
213 | 214 |
214 MOCK_METHOD2(MockableProcessMessage, | 215 MOCK_METHOD2(MockableProcessMessage, |
215 void(const BlimpMessage& message, | 216 void(const BlimpMessage& message, |
216 const net::CompletionCallback& callback)); | 217 const net::CompletionCallback& callback)); |
217 }; | 218 }; |
218 | 219 |
219 } // namespace blimp | 220 } // namespace blimp |
220 | 221 |
221 #endif // BLIMP_NET_TEST_COMMON_H_ | 222 #endif // BLIMP_NET_TEST_COMMON_H_ |
OLD | NEW |