| 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_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 7 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| 8 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 8 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
| 13 #include "net/quic/quic_connection.h" | 13 #include "net/quic/quic_connection.h" |
| 14 #include "net/quic/quic_packet_writer.h" | 14 #include "net/quic/quic_packet_writer.h" |
| 15 #include "net/quic/quic_session.h" | 15 #include "net/quic/quic_session.h" |
| 16 #include "net/quic/quic_spdy_decompressor.h" | |
| 17 #include "net/spdy/spdy_framer.h" | 16 #include "net/spdy/spdy_framer.h" |
| 18 #include "net/tools/quic/quic_server_session.h" | 17 #include "net/tools/quic/quic_server_session.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| 20 | 19 |
| 21 namespace net { | 20 namespace net { |
| 22 | 21 |
| 23 class EpollServer; | 22 class EpollServer; |
| 24 class IPEndPoint; | 23 class IPEndPoint; |
| 25 | 24 |
| 26 namespace tools { | 25 namespace tools { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 133 |
| 135 class MockQuicServerSessionVisitor : public QuicServerSessionVisitor { | 134 class MockQuicServerSessionVisitor : public QuicServerSessionVisitor { |
| 136 public: | 135 public: |
| 137 MockQuicServerSessionVisitor(); | 136 MockQuicServerSessionVisitor(); |
| 138 virtual ~MockQuicServerSessionVisitor(); | 137 virtual ~MockQuicServerSessionVisitor(); |
| 139 MOCK_METHOD2(OnConnectionClosed, void(QuicConnectionId connection_id, | 138 MOCK_METHOD2(OnConnectionClosed, void(QuicConnectionId connection_id, |
| 140 QuicErrorCode error)); | 139 QuicErrorCode error)); |
| 141 MOCK_METHOD1(OnWriteBlocked, void(QuicBlockedWriterInterface* writer)); | 140 MOCK_METHOD1(OnWriteBlocked, void(QuicBlockedWriterInterface* writer)); |
| 142 }; | 141 }; |
| 143 | 142 |
| 144 class TestDecompressorVisitor : public QuicSpdyDecompressor::Visitor { | |
| 145 public: | |
| 146 virtual ~TestDecompressorVisitor() {} | |
| 147 virtual bool OnDecompressedData(base::StringPiece data) OVERRIDE; | |
| 148 virtual void OnDecompressionError() OVERRIDE; | |
| 149 | |
| 150 std::string data() { return data_; } | |
| 151 bool error() { return error_; } | |
| 152 | |
| 153 private: | |
| 154 std::string data_; | |
| 155 bool error_; | |
| 156 }; | |
| 157 | |
| 158 class MockAckNotifierDelegate : public QuicAckNotifier::DelegateInterface { | 143 class MockAckNotifierDelegate : public QuicAckNotifier::DelegateInterface { |
| 159 public: | 144 public: |
| 160 MockAckNotifierDelegate(); | 145 MockAckNotifierDelegate(); |
| 161 | 146 |
| 162 MOCK_METHOD0(OnAckNotification, void()); | 147 MOCK_METHOD0(OnAckNotification, void()); |
| 163 | 148 |
| 164 protected: | 149 protected: |
| 165 // Object is ref counted. | 150 // Object is ref counted. |
| 166 virtual ~MockAckNotifierDelegate(); | 151 virtual ~MockAckNotifierDelegate(); |
| 167 }; | 152 }; |
| 168 | 153 |
| 169 } // namespace test | 154 } // namespace test |
| 170 } // namespace tools | 155 } // namespace tools |
| 171 } // namespace net | 156 } // namespace net |
| 172 | 157 |
| 173 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 158 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| OLD | NEW |