| 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 |
| 5 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 8 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| 6 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 9 #define NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| 7 | 10 |
| 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 | |
| 16 namespace net { | 11 namespace net { |
| 17 | 12 |
| 18 class EpollServer; | 13 class EpollServer; |
| 19 class IPEndPoint; | 14 class IPEndPoint; |
| 20 | 15 |
| 21 namespace tools { | 16 namespace tools { |
| 22 namespace test { | 17 namespace test { |
| 23 | 18 |
| 24 std::string SerializeUncompressedHeaders(const SpdyHeaderBlock& headers); | |
| 25 | |
| 26 class MockConnection : public QuicConnection { | 19 class MockConnection : public QuicConnection { |
| 27 public: | 20 public: |
| 28 // Uses a QuicConnectionHelper created with fd and eps. | 21 // Uses a QuicConnectionHelper created with fd and eps. |
| 29 MockConnection(QuicGuid guid, | 22 MockConnection(QuicGuid guid, |
| 30 IPEndPoint address, | 23 IPEndPoint address, |
| 31 int fd, | 24 int fd, |
| 32 EpollServer* eps, | 25 EpollServer* eps, |
| 33 bool is_server); | 26 bool is_server); |
| 34 // Uses a MockHelper. | 27 // Uses a MockHelper. |
| 35 MockConnection(QuicGuid guid, IPEndPoint address, bool is_server); | 28 MockConnection(QuicGuid guid, IPEndPoint address, bool is_server); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 65 virtual bool OnProtocolVersionMismatch(QuicVersionTag version) { | 58 virtual bool OnProtocolVersionMismatch(QuicVersionTag version) { |
| 66 return false; | 59 return false; |
| 67 } | 60 } |
| 68 | 61 |
| 69 private: | 62 private: |
| 70 const bool has_mock_helper_; | 63 const bool has_mock_helper_; |
| 71 | 64 |
| 72 DISALLOW_COPY_AND_ASSIGN(MockConnection); | 65 DISALLOW_COPY_AND_ASSIGN(MockConnection); |
| 73 }; | 66 }; |
| 74 | 67 |
| 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 | |
| 86 } // namespace test | 68 } // namespace test |
| 87 } // namespace tools | 69 } // namespace tools |
| 88 } // namespace net | 70 } // namespace net |
| 89 | 71 |
| 90 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ | 72 #endif // NET_TOOLS_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ |
| OLD | NEW |