OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/ref_counted.h" | 5 #include "base/ref_counted.h" |
6 #include "base/trace_event.h" | 6 #include "base/trace_event.h" |
7 #include "net/base/address_list.h" | 7 #include "net/base/address_list.h" |
8 #include "net/base/host_resolver.h" | 8 #include "net/base/host_resolver.h" |
9 #include "net/base/listen_socket.h" | 9 #include "net/base/listen_socket.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 // Implement ListenSocketDelegate methods | 23 // Implement ListenSocketDelegate methods |
24 virtual void DidAccept(ListenSocket* server, ListenSocket* connection) { | 24 virtual void DidAccept(ListenSocket* server, ListenSocket* connection) { |
25 // This callback doesn't seem to happen | 25 // This callback doesn't seem to happen |
26 // right away, so this handler may not be called at all | 26 // right away, so this handler may not be called at all |
27 // during connect-only tests. | 27 // during connect-only tests. |
28 LOG(INFO) << "TCPPinger accepted connection"; | 28 LOG(INFO) << "TCPPinger accepted connection"; |
29 connected_sock_ = connection; | 29 connected_sock_ = connection; |
30 } | 30 } |
31 virtual void DidRead(ListenSocket*, const std::string& s) { | 31 virtual void DidRead(ListenSocket*, const char* str, int len) { |
32 // Not really needed yet, as TCPPinger doesn't support Read | 32 // Not really needed yet, as TCPPinger doesn't support Read |
33 connected_sock_->Send(std::string("HTTP/1.1 404 Not Found"), true); | 33 connected_sock_->Send(std::string("HTTP/1.1 404 Not Found"), true); |
34 connected_sock_ = NULL; | 34 connected_sock_ = NULL; |
35 } | 35 } |
36 virtual void DidClose(ListenSocket* sock) {} | 36 virtual void DidClose(ListenSocket* sock) {} |
37 | 37 |
38 // Testcase hooks | 38 // Testcase hooks |
39 virtual void SetUp(); | 39 virtual void SetUp(); |
40 | 40 |
41 protected: | 41 protected: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 listen_sock_ = NULL; | 84 listen_sock_ = NULL; |
85 | 85 |
86 net::HostResolver::RequestInfo info("localhost", listen_port_); | 86 net::HostResolver::RequestInfo info("localhost", listen_port_); |
87 int rv = resolver->Resolve(info, &addr, NULL, NULL, net::BoundNetLog()); | 87 int rv = resolver->Resolve(info, &addr, NULL, NULL, net::BoundNetLog()); |
88 EXPECT_EQ(rv, net::OK); | 88 EXPECT_EQ(rv, net::OK); |
89 | 89 |
90 net::TCPPinger pinger(addr); | 90 net::TCPPinger pinger(addr); |
91 rv = pinger.Ping(base::TimeDelta::FromMilliseconds(100), 1); | 91 rv = pinger.Ping(base::TimeDelta::FromMilliseconds(100), 1); |
92 EXPECT_NE(rv, net::OK); | 92 EXPECT_NE(rv, net::OK); |
93 } | 93 } |
OLD | NEW |