| 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/http/http_pipelined_connection.h" | 5 #include "net/http/http_pipelined_connection.h" |
| 6 #include "net/http/http_pipelined_host.h" | 6 #include "net/http/http_pipelined_host.h" |
| 7 #include "testing/gmock/include/gmock/gmock.h" | 7 #include "testing/gmock/include/gmock/gmock.h" |
| 8 | 8 |
| 9 namespace net { | 9 namespace net { |
| 10 | 10 |
| 11 class MockHostDelegate : public HttpPipelinedHost::Delegate { | 11 class MockHostDelegate : public HttpPipelinedHost::Delegate { |
| 12 public: | 12 public: |
| 13 MockHostDelegate(); | 13 MockHostDelegate(); |
| 14 virtual ~MockHostDelegate(); | 14 virtual ~MockHostDelegate(); |
| 15 | 15 |
| 16 MOCK_METHOD1(OnHostIdle, void(HttpPipelinedHost* host)); | 16 MOCK_METHOD1(OnHostIdle, void(HttpPipelinedHost* host)); |
| 17 MOCK_METHOD1(OnHostHasAdditionalCapacity, void(HttpPipelinedHost* host)); | 17 MOCK_METHOD1(OnHostHasAdditionalCapacity, void(HttpPipelinedHost* host)); |
| 18 MOCK_METHOD2(OnHostDeterminedCapability, | 18 MOCK_METHOD2(OnHostDeterminedCapability, |
| 19 void(HttpPipelinedHost* host, | 19 void(HttpPipelinedHost* host, |
| 20 HttpPipelinedHostCapability capability)); | 20 HttpPipelinedHostCapability capability)); |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 class MockPipelineFactory : public HttpPipelinedConnection::Factory { | 23 class MockPipelineFactory : public HttpPipelinedConnection::Factory { |
| 24 public: | 24 public: |
| 25 MockPipelineFactory(); | 25 MockPipelineFactory(); |
| 26 virtual ~MockPipelineFactory(); | 26 virtual ~MockPipelineFactory(); |
| 27 | 27 |
| 28 MOCK_METHOD8(CreateNewPipeline, HttpPipelinedConnection*( | 28 MOCK_METHOD8( |
| 29 ClientSocketHandle* connection, | 29 CreateNewPipeline, |
| 30 HttpPipelinedConnection::Delegate* delegate, | 30 HttpPipelinedConnection*(ClientSocketHandle* connection, |
| 31 const HostPortPair& origin, | 31 HttpPipelinedConnection::Delegate* delegate, |
| 32 const SSLConfig& used_ssl_config, | 32 const HostPortPair& origin, |
| 33 const ProxyInfo& used_proxy_info, | 33 const SSLConfig& used_ssl_config, |
| 34 const BoundNetLog& net_log, | 34 const ProxyInfo& used_proxy_info, |
| 35 bool was_npn_negotiated, | 35 const BoundNetLog& net_log, |
| 36 NextProto protocol_negotiated)); | 36 bool was_npn_negotiated, |
| 37 NextProto protocol_negotiated)); |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 class MockPipeline : public HttpPipelinedConnection { | 40 class MockPipeline : public HttpPipelinedConnection { |
| 40 public: | 41 public: |
| 41 MockPipeline(int depth, bool usable, bool active); | 42 MockPipeline(int depth, bool usable, bool active); |
| 42 virtual ~MockPipeline(); | 43 virtual ~MockPipeline(); |
| 43 | 44 |
| 44 void SetState(int depth, bool usable, bool active) { | 45 void SetState(int depth, bool usable, bool active) { |
| 45 depth_ = depth; | 46 depth_ = depth; |
| 46 usable_ = usable; | 47 usable_ = usable; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 58 MOCK_CONST_METHOD0(net_log, const BoundNetLog&()); | 59 MOCK_CONST_METHOD0(net_log, const BoundNetLog&()); |
| 59 MOCK_CONST_METHOD0(was_npn_negotiated, bool()); | 60 MOCK_CONST_METHOD0(was_npn_negotiated, bool()); |
| 60 MOCK_CONST_METHOD0(protocol_negotiated, NextProto()); | 61 MOCK_CONST_METHOD0(protocol_negotiated, NextProto()); |
| 61 | 62 |
| 62 private: | 63 private: |
| 63 int depth_; | 64 int depth_; |
| 64 bool usable_; | 65 bool usable_; |
| 65 bool active_; | 66 bool active_; |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 MATCHER_P(MatchesOrigin, expected, "") { return expected.Equals(arg); } | 69 MATCHER_P(MatchesOrigin, expected, "") { |
| 70 return expected.Equals(arg); |
| 71 } |
| 69 | 72 |
| 70 } // namespace net | 73 } // namespace net |
| OLD | NEW |