Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: net/socket/socket_test_util.h

Issue 817653003: Update from https://crrev.com/309717 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_stream_factory_test.cc ('k') | net/socket/ssl_client_socket_openssl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef NET_SOCKET_SOCKET_TEST_UTIL_H_ 5 #ifndef NET_SOCKET_SOCKET_TEST_UTIL_H_
6 #define NET_SOCKET_SOCKET_TEST_UTIL_H_ 6 #define NET_SOCKET_SOCKET_TEST_UTIL_H_
7 7
8 #include <cstring> 8 #include <cstring>
9 #include <deque> 9 #include <deque>
10 #include <string> 10 #include <string>
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 DynamicSocketDataProvider(); 286 DynamicSocketDataProvider();
287 ~DynamicSocketDataProvider() override; 287 ~DynamicSocketDataProvider() override;
288 288
289 int short_read_limit() const { return short_read_limit_; } 289 int short_read_limit() const { return short_read_limit_; }
290 void set_short_read_limit(int limit) { short_read_limit_ = limit; } 290 void set_short_read_limit(int limit) { short_read_limit_ = limit; }
291 291
292 void allow_unconsumed_reads(bool allow) { allow_unconsumed_reads_ = allow; } 292 void allow_unconsumed_reads(bool allow) { allow_unconsumed_reads_ = allow; }
293 293
294 // SocketDataProvider implementation. 294 // SocketDataProvider implementation.
295 MockRead GetNextRead() override; 295 MockRead GetNextRead() override;
296 virtual MockWriteResult OnWrite(const std::string& data) = 0; 296 MockWriteResult OnWrite(const std::string& data) override = 0;
297 void Reset() override; 297 void Reset() override;
298 298
299 protected: 299 protected:
300 // The next time there is a read from this socket, it will return |data|. 300 // The next time there is a read from this socket, it will return |data|.
301 // Before calling SimulateRead next time, the previous data must be consumed. 301 // Before calling SimulateRead next time, the previous data must be consumed.
302 void SimulateRead(const char* data, size_t length); 302 void SimulateRead(const char* data, size_t length);
303 void SimulateRead(const char* data) { SimulateRead(data, std::strlen(data)); } 303 void SimulateRead(const char* data) { SimulateRead(data, std::strlen(data)); }
304 304
305 private: 305 private:
306 std::deque<MockRead> reads_; 306 std::deque<MockRead> reads_;
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 class MockClientSocket : public SSLClientSocket { 675 class MockClientSocket : public SSLClientSocket {
676 public: 676 public:
677 // Value returned by GetTLSUniqueChannelBinding(). 677 // Value returned by GetTLSUniqueChannelBinding().
678 static const char kTlsUnique[]; 678 static const char kTlsUnique[];
679 679
680 // The BoundNetLog is needed to test LoadTimingInfo, which uses NetLog IDs as 680 // The BoundNetLog is needed to test LoadTimingInfo, which uses NetLog IDs as
681 // unique socket IDs. 681 // unique socket IDs.
682 explicit MockClientSocket(const BoundNetLog& net_log); 682 explicit MockClientSocket(const BoundNetLog& net_log);
683 683
684 // Socket implementation. 684 // Socket implementation.
685 virtual int Read(IOBuffer* buf, 685 int Read(IOBuffer* buf,
686 int buf_len, 686 int buf_len,
687 const CompletionCallback& callback) = 0; 687 const CompletionCallback& callback) override = 0;
688 virtual int Write(IOBuffer* buf, 688 int Write(IOBuffer* buf,
689 int buf_len, 689 int buf_len,
690 const CompletionCallback& callback) = 0; 690 const CompletionCallback& callback) override = 0;
691 int SetReceiveBufferSize(int32 size) override; 691 int SetReceiveBufferSize(int32 size) override;
692 int SetSendBufferSize(int32 size) override; 692 int SetSendBufferSize(int32 size) override;
693 693
694 // StreamSocket implementation. 694 // StreamSocket implementation.
695 virtual int Connect(const CompletionCallback& callback) = 0; 695 int Connect(const CompletionCallback& callback) override = 0;
696 void Disconnect() override; 696 void Disconnect() override;
697 bool IsConnected() const override; 697 bool IsConnected() const override;
698 bool IsConnectedAndIdle() const override; 698 bool IsConnectedAndIdle() const override;
699 int GetPeerAddress(IPEndPoint* address) const override; 699 int GetPeerAddress(IPEndPoint* address) const override;
700 int GetLocalAddress(IPEndPoint* address) const override; 700 int GetLocalAddress(IPEndPoint* address) const override;
701 const BoundNetLog& NetLog() const override; 701 const BoundNetLog& NetLog() const override;
702 void SetSubresourceSpeculation() override {} 702 void SetSubresourceSpeculation() override {}
703 void SetOmniboxSpeculation() override {} 703 void SetOmniboxSpeculation() override {}
704 704
705 // SSLClientSocket implementation. 705 // SSLClientSocket implementation.
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 1327
1328 extern const char kSOCKS5OkRequest[]; 1328 extern const char kSOCKS5OkRequest[];
1329 extern const int kSOCKS5OkRequestLength; 1329 extern const int kSOCKS5OkRequestLength;
1330 1330
1331 extern const char kSOCKS5OkResponse[]; 1331 extern const char kSOCKS5OkResponse[];
1332 extern const int kSOCKS5OkResponseLength; 1332 extern const int kSOCKS5OkResponseLength;
1333 1333
1334 } // namespace net 1334 } // namespace net
1335 1335
1336 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ 1336 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « net/quic/quic_stream_factory_test.cc ('k') | net/socket/ssl_client_socket_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698