Windows should animate when they are about to get docked at screen edges.
[chromium-blink-merge.git] / net / tools / quic / test_tools / quic_test_utils.cc
blob95f1fb215ea2236db036c95a3b405baf2af1441f
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;
13 namespace net {
14 namespace tools {
15 namespace test {
17 MockConnection::MockConnection(QuicGuid guid,
18 IPEndPoint address,
19 int fd,
20 EpollServer* eps,
21 bool is_server)
22 : QuicConnection(guid, address,
23 new QuicEpollConnectionHelper(fd, eps), is_server,
24 QuicVersionMax()),
25 has_mock_helper_(false) {
28 MockConnection::MockConnection(QuicGuid guid,
29 IPEndPoint address,
30 bool is_server)
31 : QuicConnection(guid, address, new testing::NiceMock<MockHelper>(),
32 is_server, QuicVersionMax()),
33 has_mock_helper_(true) {
36 MockConnection::MockConnection(QuicGuid guid,
37 IPEndPoint address,
38 QuicConnectionHelperInterface* helper,
39 bool is_server)
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"
49 " used";
50 static_cast<MockHelper*>(helper())->AdvanceTime(delta);
53 bool TestDecompressorVisitor::OnDecompressedData(StringPiece data) {
54 data.AppendToString(&data_);
55 return true;
58 void TestDecompressorVisitor::OnDecompressionError() {
59 error_ = true;
62 TestSession::TestSession(QuicConnection* connection,
63 const QuicConfig& config,
64 bool is_server)
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_;
79 } // namespace test
80 } // namespace tools
81 } // namespace net