OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Common utilities for Quic tests | 5 // Common utilities for Quic tests |
6 | 6 |
7 #ifndef NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 7 #ifndef NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
8 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 8 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 class MockSession : public QuicSession { | 308 class MockSession : public QuicSession { |
309 public: | 309 public: |
310 MockSession(QuicConnection* connection, bool is_server); | 310 MockSession(QuicConnection* connection, bool is_server); |
311 virtual ~MockSession(); | 311 virtual ~MockSession(); |
312 | 312 |
313 MOCK_METHOD4(OnPacket, bool(const IPEndPoint& self_address, | 313 MOCK_METHOD4(OnPacket, bool(const IPEndPoint& self_address, |
314 const IPEndPoint& peer_address, | 314 const IPEndPoint& peer_address, |
315 const QuicPacketHeader& header, | 315 const QuicPacketHeader& header, |
316 const std::vector<QuicStreamFrame>& frame)); | 316 const std::vector<QuicStreamFrame>& frame)); |
317 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); | 317 MOCK_METHOD2(OnConnectionClosed, void(QuicErrorCode error, bool from_peer)); |
318 MOCK_METHOD1(CreateIncomingReliableStream, | 318 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); |
319 ReliableQuicStream*(QuicStreamId id)); | |
320 MOCK_METHOD0(GetCryptoStream, QuicCryptoStream*()); | 319 MOCK_METHOD0(GetCryptoStream, QuicCryptoStream*()); |
321 MOCK_METHOD0(CreateOutgoingReliableStream, ReliableQuicStream*()); | 320 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); |
322 MOCK_METHOD6(WritevData, | 321 MOCK_METHOD6(WritevData, |
323 QuicConsumedData(QuicStreamId id, | 322 QuicConsumedData(QuicStreamId id, |
324 const struct iovec* iov, | 323 const struct iovec* iov, |
325 int count, | 324 int count, |
326 QuicStreamOffset offset, | 325 QuicStreamOffset offset, |
327 bool fin, | 326 bool fin, |
328 QuicAckNotifier::DelegateInterface*)); | 327 QuicAckNotifier::DelegateInterface*)); |
329 MOCK_METHOD0(IsHandshakeComplete, bool()); | 328 MOCK_METHOD0(IsHandshakeComplete, bool()); |
330 MOCK_METHOD0(IsCryptoHandshakeConfirmed, bool()); | 329 MOCK_METHOD0(IsCryptoHandshakeConfirmed, bool()); |
331 | 330 |
332 private: | 331 private: |
333 DISALLOW_COPY_AND_ASSIGN(MockSession); | 332 DISALLOW_COPY_AND_ASSIGN(MockSession); |
334 }; | 333 }; |
335 | 334 |
336 class TestSession : public QuicSession { | 335 class TestSession : public QuicSession { |
337 public: | 336 public: |
338 TestSession(QuicConnection* connection, | 337 TestSession(QuicConnection* connection, |
339 const QuicConfig& config, | 338 const QuicConfig& config, |
340 bool is_server); | 339 bool is_server); |
341 virtual ~TestSession(); | 340 virtual ~TestSession(); |
342 | 341 |
343 MOCK_METHOD1(CreateIncomingReliableStream, | 342 MOCK_METHOD1(CreateIncomingDataStream, QuicDataStream*(QuicStreamId id)); |
344 ReliableQuicStream*(QuicStreamId id)); | 343 MOCK_METHOD0(CreateOutgoingDataStream, QuicDataStream*()); |
345 MOCK_METHOD0(CreateOutgoingReliableStream, ReliableQuicStream*()); | |
346 | 344 |
347 void SetCryptoStream(QuicCryptoStream* stream); | 345 void SetCryptoStream(QuicCryptoStream* stream); |
348 | 346 |
349 virtual QuicCryptoStream* GetCryptoStream(); | 347 virtual QuicCryptoStream* GetCryptoStream(); |
350 | 348 |
351 private: | 349 private: |
352 QuicCryptoStream* crypto_stream_; | 350 QuicCryptoStream* crypto_stream_; |
353 DISALLOW_COPY_AND_ASSIGN(TestSession); | 351 DISALLOW_COPY_AND_ASSIGN(TestSession); |
354 }; | 352 }; |
355 | 353 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 MockAckNotifierDelegate(); | 436 MockAckNotifierDelegate(); |
439 virtual ~MockAckNotifierDelegate(); | 437 virtual ~MockAckNotifierDelegate(); |
440 | 438 |
441 MOCK_METHOD0(OnAckNotification, void()); | 439 MOCK_METHOD0(OnAckNotification, void()); |
442 }; | 440 }; |
443 | 441 |
444 } // namespace test | 442 } // namespace test |
445 } // namespace net | 443 } // namespace net |
446 | 444 |
447 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 445 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
OLD | NEW |