Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1949)

Side by Side Diff: blimp/net/test_common.h

Issue 2439403003: Refactor BlimpConnection to TCPConnection (Closed)
Patch Set: Added missing Engine Transport Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 MOCK_CONST_METHOD0(GetConnectTimeMicros, base::TimeDelta()); 128 MOCK_CONST_METHOD0(GetConnectTimeMicros, base::TimeDelta());
129 MOCK_CONST_METHOD0(WasNpnNegotiated, bool()); 129 MOCK_CONST_METHOD0(WasNpnNegotiated, bool());
130 MOCK_CONST_METHOD0(GetNegotiatedProtocol, net::NextProto()); 130 MOCK_CONST_METHOD0(GetNegotiatedProtocol, net::NextProto());
131 MOCK_METHOD1(GetSSLInfo, bool(net::SSLInfo*)); 131 MOCK_METHOD1(GetSSLInfo, bool(net::SSLInfo*));
132 MOCK_CONST_METHOD1(GetConnectionAttempts, void(net::ConnectionAttempts*)); 132 MOCK_CONST_METHOD1(GetConnectionAttempts, void(net::ConnectionAttempts*));
133 MOCK_METHOD0(ClearConnectionAttempts, void()); 133 MOCK_METHOD0(ClearConnectionAttempts, void());
134 MOCK_METHOD1(AddConnectionAttempts, void(const net::ConnectionAttempts&)); 134 MOCK_METHOD1(AddConnectionAttempts, void(const net::ConnectionAttempts&));
135 MOCK_CONST_METHOD0(GetTotalReceivedBytes, int64_t()); 135 MOCK_CONST_METHOD0(GetTotalReceivedBytes, int64_t());
136 }; 136 };
137 137
138 class MockBlimpConnection;
139
138 class MockTransport : public BlimpTransport { 140 class MockTransport : public BlimpTransport {
139 public: 141 public:
140 MockTransport(); 142 MockTransport();
141 ~MockTransport() override; 143 ~MockTransport() override;
142 144
143 MOCK_METHOD1(Connect, void(const net::CompletionCallback& callback)); 145 MOCK_METHOD1(Connect, void(const net::CompletionCallback& callback));
144 MOCK_METHOD0(TakeMessagePortPtr, MessagePort*()); 146 MOCK_METHOD0(TakeMessagePortPtr, MessagePort*());
147 std::unique_ptr<BlimpConnection> MakeConnection() override;
145 148
146 std::unique_ptr<MessagePort> TakeMessagePort() override;
147 const char* GetName() const override; 149 const char* GetName() const override;
150
151 void SetMockConnection(std::unique_ptr<MockBlimpConnection> connection);
152
153 private:
154 std::unique_ptr<MockBlimpConnection> connection_;
148 }; 155 };
149 156
150 class MockConnectionHandler : public ConnectionHandler { 157 class MockConnectionHandler : public ConnectionHandler {
151 public: 158 public:
152 MockConnectionHandler(); 159 MockConnectionHandler();
153 ~MockConnectionHandler() override; 160 ~MockConnectionHandler() override;
154 161
155 MOCK_METHOD1(HandleConnectionPtr, void(BlimpConnection* connection)); 162 MOCK_METHOD1(HandleConnectionPtr, void(BlimpConnection* connection));
156 void HandleConnection(std::unique_ptr<BlimpConnection> connection) override; 163 void HandleConnection(std::unique_ptr<BlimpConnection> connection) override;
157 }; 164 };
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 const net::CompletionCallback& callback) override; 221 const net::CompletionCallback& callback) override;
215 222
216 MOCK_METHOD2(MockableProcessMessage, 223 MOCK_METHOD2(MockableProcessMessage,
217 void(const BlimpMessage& message, 224 void(const BlimpMessage& message,
218 const net::CompletionCallback& callback)); 225 const net::CompletionCallback& callback));
219 }; 226 };
220 227
221 } // namespace blimp 228 } // namespace blimp
222 229
223 #endif // BLIMP_NET_TEST_COMMON_H_ 230 #endif // BLIMP_NET_TEST_COMMON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698