| 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 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 virtual ~MockPipelineFactory(); | 26 virtual ~MockPipelineFactory(); |
| 27 | 27 |
| 28 MOCK_METHOD8(CreateNewPipeline, HttpPipelinedConnection*( | 28 MOCK_METHOD8(CreateNewPipeline, HttpPipelinedConnection*( |
| 29 ClientSocketHandle* connection, | 29 ClientSocketHandle* connection, |
| 30 HttpPipelinedConnection::Delegate* delegate, | 30 HttpPipelinedConnection::Delegate* delegate, |
| 31 const HostPortPair& origin, | 31 const HostPortPair& origin, |
| 32 const SSLConfig& used_ssl_config, | 32 const SSLConfig& used_ssl_config, |
| 33 const ProxyInfo& used_proxy_info, | 33 const ProxyInfo& used_proxy_info, |
| 34 const BoundNetLog& net_log, | 34 const BoundNetLog& net_log, |
| 35 bool was_npn_negotiated, | 35 bool was_npn_negotiated, |
| 36 SSLClientSocket::NextProto protocol_negotiated)); | 36 NextProto protocol_negotiated)); |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 class MockPipeline : public HttpPipelinedConnection { | 39 class MockPipeline : public HttpPipelinedConnection { |
| 40 public: | 40 public: |
| 41 MockPipeline(int depth, bool usable, bool active); | 41 MockPipeline(int depth, bool usable, bool active); |
| 42 virtual ~MockPipeline(); | 42 virtual ~MockPipeline(); |
| 43 | 43 |
| 44 void SetState(int depth, bool usable, bool active) { | 44 void SetState(int depth, bool usable, bool active) { |
| 45 depth_ = depth; | 45 depth_ = depth; |
| 46 usable_ = usable; | 46 usable_ = usable; |
| 47 active_ = active; | 47 active_ = active; |
| 48 } | 48 } |
| 49 | 49 |
| 50 virtual int depth() const OVERRIDE { return depth_; } | 50 virtual int depth() const OVERRIDE { return depth_; } |
| 51 virtual bool usable() const OVERRIDE { return usable_; } | 51 virtual bool usable() const OVERRIDE { return usable_; } |
| 52 virtual bool active() const OVERRIDE { return active_; } | 52 virtual bool active() const OVERRIDE { return active_; } |
| 53 | 53 |
| 54 MOCK_METHOD0(CreateNewStream, HttpPipelinedStream*()); | 54 MOCK_METHOD0(CreateNewStream, HttpPipelinedStream*()); |
| 55 MOCK_METHOD1(OnStreamDeleted, void(int pipeline_id)); | 55 MOCK_METHOD1(OnStreamDeleted, void(int pipeline_id)); |
| 56 MOCK_CONST_METHOD0(used_ssl_config, const SSLConfig&()); | 56 MOCK_CONST_METHOD0(used_ssl_config, const SSLConfig&()); |
| 57 MOCK_CONST_METHOD0(used_proxy_info, const ProxyInfo&()); | 57 MOCK_CONST_METHOD0(used_proxy_info, const ProxyInfo&()); |
| 58 MOCK_CONST_METHOD0(net_log, const BoundNetLog&()); | 58 MOCK_CONST_METHOD0(net_log, const BoundNetLog&()); |
| 59 MOCK_CONST_METHOD0(was_npn_negotiated, bool()); | 59 MOCK_CONST_METHOD0(was_npn_negotiated, bool()); |
| 60 MOCK_CONST_METHOD0(protocol_negotiated, SSLClientSocket::NextProto()); | 60 MOCK_CONST_METHOD0(protocol_negotiated, NextProto()); |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 int depth_; | 63 int depth_; |
| 64 bool usable_; | 64 bool usable_; |
| 65 bool active_; | 65 bool active_; |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 MATCHER_P(MatchesOrigin, expected, "") { return expected.Equals(arg); } | 68 MATCHER_P(MatchesOrigin, expected, "") { return expected.Equals(arg); } |
| 69 | 69 |
| 70 } // namespace net | 70 } // namespace net |
| OLD | NEW |