| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/platform_test.h" | |
| 6 #include "net/base/address_list.h" | 5 #include "net/base/address_list.h" |
| 7 #include "net/base/host_resolver.h" | 6 #include "net/base/host_resolver.h" |
| 8 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
| 9 #include "net/base/scoped_host_mapper.h" | 8 #include "net/base/scoped_host_mapper.h" |
| 10 #include "net/base/tcp_client_socket.h" | 9 #include "net/base/tcp_client_socket.h" |
| 11 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "testing/platform_test.h" |
| 13 | 13 |
| 14 class TCPClientSocketTest : public PlatformTest { | 14 class TCPClientSocketTest : public PlatformTest { |
| 15 public: | 15 public: |
| 16 TCPClientSocketTest() { | 16 TCPClientSocketTest() { |
| 17 // TODO(darin): kill this exception once we have a way to test out the | 17 // TODO(darin): kill this exception once we have a way to test out the |
| 18 // TCPClientSocket class using loopback connections. | 18 // TCPClientSocket class using loopback connections. |
| 19 host_mapper_.AddRule("www.google.com", "www.google.com"); | 19 host_mapper_.AddRule("www.google.com", "www.google.com"); |
| 20 } | 20 } |
| 21 private: | 21 private: |
| 22 net::ScopedHostMapper host_mapper_; | 22 net::ScopedHostMapper host_mapper_; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // Do a partial read and then exit. This test should not crash! | 164 // Do a partial read and then exit. This test should not crash! |
| 165 char buf[512]; | 165 char buf[512]; |
| 166 rv = sock.Read(buf, sizeof(buf), &callback); | 166 rv = sock.Read(buf, sizeof(buf), &callback); |
| 167 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); | 167 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); |
| 168 | 168 |
| 169 if (rv == net::ERR_IO_PENDING) | 169 if (rv == net::ERR_IO_PENDING) |
| 170 rv = callback.WaitForResult(); | 170 rv = callback.WaitForResult(); |
| 171 | 171 |
| 172 EXPECT_NE(rv, 0); | 172 EXPECT_NE(rv, 0); |
| 173 } | 173 } |
| OLD | NEW |