| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
| 14 #include "extensions/browser/api/socket/tls_socket.h" | 14 #include "extensions/browser/api/socket/tls_socket.h" |
| 15 #include "net/base/address_list.h" | 15 #include "net/base/address_list.h" |
| 16 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
| 17 #include "net/base/io_buffer.h" | 17 #include "net/base/io_buffer.h" |
| 18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 19 #include "net/base/rand_callback.h" | 19 #include "net/base/rand_callback.h" |
| 20 #include "net/log/net_log_source.h" |
| 21 #include "net/log/net_log_with_source.h" |
| 20 #include "net/socket/next_proto.h" | 22 #include "net/socket/next_proto.h" |
| 21 #include "net/socket/ssl_client_socket.h" | 23 #include "net/socket/ssl_client_socket.h" |
| 22 #include "net/socket/tcp_client_socket.h" | 24 #include "net/socket/tcp_client_socket.h" |
| 23 #include "testing/gmock/include/gmock/gmock.h" | 25 #include "testing/gmock/include/gmock/gmock.h" |
| 24 | 26 |
| 25 using testing::_; | 27 using testing::_; |
| 26 using testing::DoAll; | 28 using testing::DoAll; |
| 27 using testing::Invoke; | 29 using testing::Invoke; |
| 28 using testing::Gt; | 30 using testing::Gt; |
| 29 using testing::Return; | 31 using testing::Return; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 MOCK_CONST_METHOD0(GetChannelIDKey, crypto::ECPrivateKey*()); | 82 MOCK_CONST_METHOD0(GetChannelIDKey, crypto::ECPrivateKey*()); |
| 81 bool IsConnected() const override { return true; } | 83 bool IsConnected() const override { return true; } |
| 82 | 84 |
| 83 private: | 85 private: |
| 84 DISALLOW_COPY_AND_ASSIGN(MockSSLClientSocket); | 86 DISALLOW_COPY_AND_ASSIGN(MockSSLClientSocket); |
| 85 }; | 87 }; |
| 86 | 88 |
| 87 class MockTCPSocket : public net::TCPClientSocket { | 89 class MockTCPSocket : public net::TCPClientSocket { |
| 88 public: | 90 public: |
| 89 explicit MockTCPSocket(const net::AddressList& address_list) | 91 explicit MockTCPSocket(const net::AddressList& address_list) |
| 90 : net::TCPClientSocket(address_list, NULL, NULL, net::NetLog::Source()) {} | 92 : net::TCPClientSocket(address_list, NULL, NULL, net::NetLogSource()) {} |
| 91 | 93 |
| 92 MOCK_METHOD3(Read, | 94 MOCK_METHOD3(Read, |
| 93 int(net::IOBuffer* buf, | 95 int(net::IOBuffer* buf, |
| 94 int buf_len, | 96 int buf_len, |
| 95 const net::CompletionCallback& callback)); | 97 const net::CompletionCallback& callback)); |
| 96 MOCK_METHOD3(Write, | 98 MOCK_METHOD3(Write, |
| 97 int(net::IOBuffer* buf, | 99 int(net::IOBuffer* buf, |
| 98 int buf_len, | 100 int buf_len, |
| 99 const net::CompletionCallback& callback)); | 101 const net::CompletionCallback& callback)); |
| 100 MOCK_METHOD2(SetKeepAlive, bool(bool enable, int delay)); | 102 MOCK_METHOD2(SetKeepAlive, bool(bool enable, int delay)); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 total_bytes_written += amount_written_invocation; | 318 total_bytes_written += amount_written_invocation; |
| 317 cb.first.Run(amount_written_invocation); | 319 cb.first.Run(amount_written_invocation); |
| 318 } | 320 } |
| 319 | 321 |
| 320 ASSERT_EQ(total_bytes_requested, total_bytes_written) | 322 ASSERT_EQ(total_bytes_requested, total_bytes_written) |
| 321 << "There should be exactly as many bytes written as originally " | 323 << "There should be exactly as many bytes written as originally " |
| 322 << "requested to Write()."; | 324 << "requested to Write()."; |
| 323 } | 325 } |
| 324 | 326 |
| 325 } // namespace extensions | 327 } // namespace extensions |
| OLD | NEW |