| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/socket/tls_socket.h" | 5 #include "extensions/browser/api/socket/tls_socket.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 MOCK_METHOD1(GetTLSUniqueChannelBinding, int(std::string*)); | 62 MOCK_METHOD1(GetTLSUniqueChannelBinding, int(std::string*)); |
| 63 MOCK_CONST_METHOD0(GetSessionCacheKey, std::string()); | 63 MOCK_CONST_METHOD0(GetSessionCacheKey, std::string()); |
| 64 MOCK_CONST_METHOD0(InSessionCache, bool()); | 64 MOCK_CONST_METHOD0(InSessionCache, bool()); |
| 65 MOCK_METHOD1(SetHandshakeCompletionCallback, void(const base::Closure&)); | 65 MOCK_METHOD1(SetHandshakeCompletionCallback, void(const base::Closure&)); |
| 66 MOCK_METHOD1(GetSSLCertRequestInfo, void(net::SSLCertRequestInfo*)); | 66 MOCK_METHOD1(GetSSLCertRequestInfo, void(net::SSLCertRequestInfo*)); |
| 67 MOCK_METHOD1(GetNextProto, | 67 MOCK_METHOD1(GetNextProto, |
| 68 net::SSLClientSocket::NextProtoStatus(std::string*)); | 68 net::SSLClientSocket::NextProtoStatus(std::string*)); |
| 69 MOCK_CONST_METHOD0(GetUnverifiedServerCertificateChain, | 69 MOCK_CONST_METHOD0(GetUnverifiedServerCertificateChain, |
| 70 scoped_refptr<net::X509Certificate>()); | 70 scoped_refptr<net::X509Certificate>()); |
| 71 MOCK_CONST_METHOD0(GetChannelIDService, net::ChannelIDService*()); | 71 MOCK_CONST_METHOD0(GetChannelIDService, net::ChannelIDService*()); |
| 72 virtual bool IsConnected() const OVERRIDE { return true; } | 72 virtual bool IsConnected() const override { return true; } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 DISALLOW_COPY_AND_ASSIGN(MockSSLClientSocket); | 75 DISALLOW_COPY_AND_ASSIGN(MockSSLClientSocket); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 class MockTCPSocket : public net::TCPClientSocket { | 78 class MockTCPSocket : public net::TCPClientSocket { |
| 79 public: | 79 public: |
| 80 explicit MockTCPSocket(const net::AddressList& address_list) | 80 explicit MockTCPSocket(const net::AddressList& address_list) |
| 81 : net::TCPClientSocket(address_list, NULL, net::NetLog::Source()) {} | 81 : net::TCPClientSocket(address_list, NULL, net::NetLog::Source()) {} |
| 82 | 82 |
| 83 MOCK_METHOD3(Read, | 83 MOCK_METHOD3(Read, |
| 84 int(net::IOBuffer* buf, | 84 int(net::IOBuffer* buf, |
| 85 int buf_len, | 85 int buf_len, |
| 86 const net::CompletionCallback& callback)); | 86 const net::CompletionCallback& callback)); |
| 87 MOCK_METHOD3(Write, | 87 MOCK_METHOD3(Write, |
| 88 int(net::IOBuffer* buf, | 88 int(net::IOBuffer* buf, |
| 89 int buf_len, | 89 int buf_len, |
| 90 const net::CompletionCallback& callback)); | 90 const net::CompletionCallback& callback)); |
| 91 MOCK_METHOD2(SetKeepAlive, bool(bool enable, int delay)); | 91 MOCK_METHOD2(SetKeepAlive, bool(bool enable, int delay)); |
| 92 MOCK_METHOD1(SetNoDelay, bool(bool no_delay)); | 92 MOCK_METHOD1(SetNoDelay, bool(bool no_delay)); |
| 93 | 93 |
| 94 virtual bool IsConnected() const OVERRIDE { return true; } | 94 virtual bool IsConnected() const override { return true; } |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 DISALLOW_COPY_AND_ASSIGN(MockTCPSocket); | 97 DISALLOW_COPY_AND_ASSIGN(MockTCPSocket); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 class CompleteHandler { | 100 class CompleteHandler { |
| 101 public: | 101 public: |
| 102 CompleteHandler() {} | 102 CompleteHandler() {} |
| 103 MOCK_METHOD1(OnComplete, void(int result_code)); | 103 MOCK_METHOD1(OnComplete, void(int result_code)); |
| 104 MOCK_METHOD2(OnReadComplete, | 104 MOCK_METHOD2(OnReadComplete, |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 total_bytes_written += amount_written_invocation; | 308 total_bytes_written += amount_written_invocation; |
| 309 cb.first.Run(amount_written_invocation); | 309 cb.first.Run(amount_written_invocation); |
| 310 } | 310 } |
| 311 | 311 |
| 312 ASSERT_EQ(total_bytes_requested, total_bytes_written) | 312 ASSERT_EQ(total_bytes_requested, total_bytes_written) |
| 313 << "There should be exactly as many bytes written as originally " | 313 << "There should be exactly as many bytes written as originally " |
| 314 << "requested to Write()."; | 314 << "requested to Write()."; |
| 315 } | 315 } |
| 316 | 316 |
| 317 } // namespace extensions | 317 } // namespace extensions |
| OLD | NEW |