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/socket/tcp_client_socket.h" | 5 #include "net/socket/tcp_client_socket.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 void DidRead(StreamListenSocket*, const char* str, int len) override { | 55 void DidRead(StreamListenSocket*, const char* str, int len) override { |
56 // TODO(dkegel): this might not be long enough to tickle some bugs. | 56 // TODO(dkegel): this might not be long enough to tickle some bugs. |
57 connected_sock_->Send(kServerReply, arraysize(kServerReply) - 1, | 57 connected_sock_->Send(kServerReply, arraysize(kServerReply) - 1, |
58 false /* Don't append line feed */); | 58 false /* Don't append line feed */); |
59 if (close_server_socket_on_next_send_) | 59 if (close_server_socket_on_next_send_) |
60 CloseServerSocket(); | 60 CloseServerSocket(); |
61 } | 61 } |
62 void DidClose(StreamListenSocket* sock) override {} | 62 void DidClose(StreamListenSocket* sock) override {} |
63 | 63 |
64 // Testcase hooks | 64 // Testcase hooks |
65 virtual void SetUp(); | 65 void SetUp() override; |
66 | 66 |
67 void CloseServerSocket() { | 67 void CloseServerSocket() { |
68 // delete the connected_sock_, which will close it. | 68 // delete the connected_sock_, which will close it. |
69 connected_sock_.reset(); | 69 connected_sock_.reset(); |
70 } | 70 } |
71 | 71 |
72 void PauseServerReads() { | 72 void PauseServerReads() { |
73 connected_sock_->PauseReads(); | 73 connected_sock_->PauseReads(); |
74 } | 74 } |
75 | 75 |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 441 |
442 // It's possible the read is blocked because it's already read all the data. | 442 // It's possible the read is blocked because it's already read all the data. |
443 // Close the server socket, so there will at least be a 0-byte read. | 443 // Close the server socket, so there will at least be a 0-byte read. |
444 CloseServerSocket(); | 444 CloseServerSocket(); |
445 | 445 |
446 rv = callback.WaitForResult(); | 446 rv = callback.WaitForResult(); |
447 EXPECT_GE(rv, 0); | 447 EXPECT_GE(rv, 0); |
448 } | 448 } |
449 | 449 |
450 } // namespace net | 450 } // namespace net |
OLD | NEW |