OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef BLIMP_NET_TEST_COMMON_H_ | 5 #ifndef BLIMP_NET_TEST_COMMON_H_ |
6 #define BLIMP_NET_TEST_COMMON_H_ | 6 #define BLIMP_NET_TEST_COMMON_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "blimp/net/blimp_message_processor.h" |
10 #include "net/socket/stream_socket.h" | 11 #include "net/socket/stream_socket.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
12 | 13 |
13 namespace net { | 14 namespace net { |
14 class GrowableIOBuffer; | 15 class GrowableIOBuffer; |
15 } // namespace net | 16 } // namespace net |
16 | 17 |
17 namespace blimp { | 18 namespace blimp { |
18 | 19 |
19 // Checks if the contents of a buffer are an exact match with std::string. | 20 // Checks if the contents of a buffer are an exact match with std::string. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 MOCK_CONST_METHOD0(GetConnectTimeMicros, base::TimeDelta()); | 64 MOCK_CONST_METHOD0(GetConnectTimeMicros, base::TimeDelta()); |
64 MOCK_CONST_METHOD0(WasNpnNegotiated, bool()); | 65 MOCK_CONST_METHOD0(WasNpnNegotiated, bool()); |
65 MOCK_CONST_METHOD0(GetNegotiatedProtocol, net::NextProto()); | 66 MOCK_CONST_METHOD0(GetNegotiatedProtocol, net::NextProto()); |
66 MOCK_METHOD1(GetSSLInfo, bool(net::SSLInfo*)); | 67 MOCK_METHOD1(GetSSLInfo, bool(net::SSLInfo*)); |
67 MOCK_CONST_METHOD1(GetConnectionAttempts, void(net::ConnectionAttempts*)); | 68 MOCK_CONST_METHOD1(GetConnectionAttempts, void(net::ConnectionAttempts*)); |
68 MOCK_METHOD0(ClearConnectionAttempts, void()); | 69 MOCK_METHOD0(ClearConnectionAttempts, void()); |
69 MOCK_METHOD1(AddConnectionAttempts, void(const net::ConnectionAttempts&)); | 70 MOCK_METHOD1(AddConnectionAttempts, void(const net::ConnectionAttempts&)); |
70 MOCK_CONST_METHOD0(GetTotalReceivedBytes, int64_t()); | 71 MOCK_CONST_METHOD0(GetTotalReceivedBytes, int64_t()); |
71 }; | 72 }; |
72 | 73 |
| 74 class MockBlimpMessageProcessor : public BlimpMessageProcessor { |
| 75 public: |
| 76 MockBlimpMessageProcessor(); |
| 77 |
| 78 ~MockBlimpMessageProcessor() override; |
| 79 |
| 80 MOCK_METHOD2(ProcessMessage, |
| 81 void(const BlimpMessage& message, |
| 82 const net::CompletionCallback& callback)); |
| 83 }; |
| 84 |
73 // Returns true if |buf| has a prefix of |str|. | 85 // Returns true if |buf| has a prefix of |str|. |
74 // Behavior is undefined if len(buf) < len(str). | 86 // Behavior is undefined if len(buf) < len(str). |
75 bool BufferStartsWith(net::GrowableIOBuffer* buf, const std::string& str); | 87 bool BufferStartsWith(net::GrowableIOBuffer* buf, const std::string& str); |
76 | 88 |
77 } // namespace blimp | 89 } // namespace blimp |
78 | 90 |
79 #endif // BLIMP_NET_TEST_COMMON_H_ | 91 #endif // BLIMP_NET_TEST_COMMON_H_ |
OLD | NEW |