| 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 #include "net/quic/quic_connection.h" | |
| 6 #include "testing/gmock/include/gmock/gmock.h" | |
| 7 | |
| 8 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 5 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| 9 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 6 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| 10 | 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/strings/string_piece.h" |
| 11 #include "net/quic/quic_connection.h" |
| 12 #include "net/quic/quic_spdy_decompressor.h" |
| 13 #include "net/spdy/spdy_framer.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" |
| 15 |
| 11 namespace net { | 16 namespace net { |
| 12 | 17 |
| 13 class EpollServer; | 18 class EpollServer; |
| 14 class IPEndPoint; | 19 class IPEndPoint; |
| 15 | 20 |
| 16 namespace tools { | 21 namespace tools { |
| 17 namespace test { | 22 namespace test { |
| 18 | 23 |
| 24 std::string SerializeUncompressedHeaders(const SpdyHeaderBlock& headers); |
| 25 |
| 19 class MockConnection : public QuicConnection { | 26 class MockConnection : public QuicConnection { |
| 20 public: | 27 public: |
| 21 // Uses a QuicConnectionHelper created with fd and eps. | 28 // Uses a QuicConnectionHelper created with fd and eps. |
| 22 MockConnection(QuicGuid guid, | 29 MockConnection(QuicGuid guid, |
| 23 IPEndPoint address, | 30 IPEndPoint address, |
| 24 int fd, | 31 int fd, |
| 25 EpollServer* eps, | 32 EpollServer* eps, |
| 26 bool is_server); | 33 bool is_server); |
| 27 // Uses a MockHelper. | 34 // Uses a MockHelper. |
| 28 MockConnection(QuicGuid guid, IPEndPoint address, bool is_server); | 35 MockConnection(QuicGuid guid, IPEndPoint address, bool is_server); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 58 virtual bool OnProtocolVersionMismatch(QuicVersionTag version) { | 65 virtual bool OnProtocolVersionMismatch(QuicVersionTag version) { |
| 59 return false; | 66 return false; |
| 60 } | 67 } |
| 61 | 68 |
| 62 private: | 69 private: |
| 63 const bool has_mock_helper_; | 70 const bool has_mock_helper_; |
| 64 | 71 |
| 65 DISALLOW_COPY_AND_ASSIGN(MockConnection); | 72 DISALLOW_COPY_AND_ASSIGN(MockConnection); |
| 66 }; | 73 }; |
| 67 | 74 |
| 75 class TestDecompressorVisitor : public QuicSpdyDecompressor::Visitor { |
| 76 public: |
| 77 virtual ~TestDecompressorVisitor() {} |
| 78 virtual bool OnDecompressedData(base::StringPiece data) OVERRIDE; |
| 79 |
| 80 std::string data() { return data_; } |
| 81 |
| 82 private: |
| 83 std::string data_; |
| 84 }; |
| 85 |
| 68 } // namespace test | 86 } // namespace test |
| 69 } // namespace tools | 87 } // namespace tools |
| 70 } // namespace net | 88 } // namespace net |
| 71 | 89 |
| 72 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 90 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| OLD | NEW |