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 "chrome/browser/extensions/api/socket/tcp_socket.h" | 5 #include "chrome/browser/extensions/api/socket/tcp_socket.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/browser/extensions/api/api_resource_event_notifier.h" | 8 #include "chrome/browser/extensions/api/api_resource_event_notifier.h" |
9 #include "net/base/address_list.h" | 9 #include "net/base/address_list.h" |
10 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 EXPECT_CALL(*tcp_client_socket, SetKeepAlive(_, _)) | 212 EXPECT_CALL(*tcp_client_socket, SetKeepAlive(_, _)) |
213 .WillOnce(testing::DoAll(SaveArg<0>(&enable), | 213 .WillOnce(testing::DoAll(SaveArg<0>(&enable), |
214 SaveArg<1>(&delay), | 214 SaveArg<1>(&delay), |
215 Return(false))); | 215 Return(false))); |
216 result = socket->SetKeepAlive(false, 0); | 216 result = socket->SetKeepAlive(false, 0); |
217 EXPECT_FALSE(result); | 217 EXPECT_FALSE(result); |
218 EXPECT_FALSE(enable); | 218 EXPECT_FALSE(enable); |
219 EXPECT_EQ(0, delay); | 219 EXPECT_EQ(0, delay); |
220 } | 220 } |
221 | 221 |
| 222 TEST(SocketTest, TestTCPSocketBind) { |
| 223 net::AddressList address_list; |
| 224 MockTCPSocket* tcp_client_socket = new MockTCPSocket(address_list); |
| 225 ApiResourceEventNotifier* notifier = new MockApiResourceEventNotifier(); |
| 226 CompleteHandler handler; |
| 227 |
| 228 scoped_ptr<TCPSocket> socket(TCPSocket::CreateSocketForTesting( |
| 229 tcp_client_socket, notifier)); |
| 230 |
| 231 socket->Bind("127.0.0.1", 100); |
| 232 } |
| 233 |
222 } // namespace extensions | 234 } // namespace extensions |
OLD | NEW |