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
3 // found in the LICENSE file.
5 #include "net/tools/quic/test_tools/quic_test_utils.h"
7 #include "net/quic/test_tools/quic_test_utils.h"
8 #include "net/tools/quic/quic_epoll_connection_helper.h"
10 using base::StringPiece
;
11 using net::test::MockHelper
;
17 MockConnection::MockConnection(QuicGuid guid
,
22 : QuicConnection(guid
, address
,
23 new QuicEpollConnectionHelper(fd
, eps
), is_server
,
25 has_mock_helper_(false) {
28 MockConnection::MockConnection(QuicGuid guid
,
31 : QuicConnection(guid
, address
, new testing::NiceMock
<MockHelper
>(),
32 is_server
, QuicVersionMax()),
33 has_mock_helper_(true) {
36 MockConnection::MockConnection(QuicGuid guid
,
38 QuicConnectionHelperInterface
* helper
,
40 : QuicConnection(guid
, address
, helper
, is_server
, QuicVersionMax()),
41 has_mock_helper_(false) {
44 MockConnection::~MockConnection() {
47 void MockConnection::AdvanceTime(QuicTime::Delta delta
) {
48 CHECK(has_mock_helper_
) << "Cannot advance time unless a MockClock is being"
50 static_cast<MockHelper
*>(helper())->AdvanceTime(delta
);
53 bool TestDecompressorVisitor::OnDecompressedData(StringPiece data
) {
54 data
.AppendToString(&data_
);
58 void TestDecompressorVisitor::OnDecompressionError() {
62 TestSession::TestSession(QuicConnection
* connection
,
63 const QuicConfig
& config
,
65 : QuicSession(connection
, config
, is_server
),
66 crypto_stream_(NULL
) {
69 TestSession::~TestSession() {}
71 void TestSession::SetCryptoStream(QuicCryptoStream
* stream
) {
72 crypto_stream_
= stream
;
75 QuicCryptoStream
* TestSession::GetCryptoStream() {
76 return crypto_stream_
;