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 "ppapi/tests/test_tcp_server_socket_private.h" | 5 #include "ppapi/tests/test_tcp_server_socket_private.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ppapi/cpp/pass_ref.h" | 9 #include "ppapi/cpp/pass_ref.h" |
10 #include "ppapi/cpp/private/net_address_private.h" | 10 #include "ppapi/cpp/private/net_address_private.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 std::vector<TCPSocketPrivate*> client_sockets(kBacklog); | 227 std::vector<TCPSocketPrivate*> client_sockets(kBacklog); |
228 std::vector<TestCompletionCallback*> connect_callbacks(kBacklog); | 228 std::vector<TestCompletionCallback*> connect_callbacks(kBacklog); |
229 std::vector<int32_t> connect_rv(kBacklog); | 229 std::vector<int32_t> connect_rv(kBacklog); |
230 for (size_t i = 0; i < kBacklog; ++i) { | 230 for (size_t i = 0; i < kBacklog; ++i) { |
231 client_sockets[i] = new TCPSocketPrivate(instance_); | 231 client_sockets[i] = new TCPSocketPrivate(instance_); |
232 connect_callbacks[i] = new TestCompletionCallback(instance_->pp_instance(), | 232 connect_callbacks[i] = new TestCompletionCallback(instance_->pp_instance(), |
233 force_async_); | 233 force_async_); |
234 connect_rv[i] = client_sockets[i]->ConnectWithNetAddress( | 234 connect_rv[i] = client_sockets[i]->ConnectWithNetAddress( |
235 &address, | 235 &address, |
236 *connect_callbacks[i]); | 236 *connect_callbacks[i]); |
237 if (force_async_ && connect_rv[i] != PP_OK_COMPLETIONPENDING) | 237 if (force_async_ && connect_rv[i] != PP_OK_COMPLETIONPENDING) { |
238 return ReportError("PPB_TCPSocket_Private::Connect force_async", | 238 return ReportError("PPB_TCPSocket_Private::Connect force_async", |
239 connect_rv[i]); | 239 connect_rv[i]); |
| 240 } |
240 } | 241 } |
241 | 242 |
242 std::vector<PP_Resource> resources(kBacklog); | 243 std::vector<PP_Resource> resources(kBacklog); |
243 std::vector<TCPSocketPrivate*> accepted_sockets(kBacklog); | 244 std::vector<TCPSocketPrivate*> accepted_sockets(kBacklog); |
244 for (size_t i = 0; i < kBacklog; ++i) { | 245 for (size_t i = 0; i < kBacklog; ++i) { |
245 TestCompletionCallback callback(instance_->pp_instance(), force_async_); | 246 TestCompletionCallback callback(instance_->pp_instance(), force_async_); |
246 int32_t rv = server_socket.Accept(&resources[i], callback); | 247 int32_t rv = server_socket.Accept(&resources[i], callback); |
247 if (force_async_ && rv != PP_OK_COMPLETIONPENDING) | 248 if (force_async_ && rv != PP_OK_COMPLETIONPENDING) |
248 return ReportError("PPB_TCPServerSocket_Private::Accept force_async", rv); | 249 return ReportError("PPB_TCPServerSocket_Private::Accept force_async", rv); |
249 if (rv == PP_OK_COMPLETIONPENDING) | 250 if (rv == PP_OK_COMPLETIONPENDING) |
(...skipping 30 matching lines...) Expand all Loading... |
280 client_sockets[i]->Disconnect(); | 281 client_sockets[i]->Disconnect(); |
281 delete client_sockets[i]; | 282 delete client_sockets[i]; |
282 delete connect_callbacks[i]; | 283 delete connect_callbacks[i]; |
283 accepted_sockets[i]->Disconnect(); | 284 accepted_sockets[i]->Disconnect(); |
284 delete accepted_sockets[i]; | 285 delete accepted_sockets[i]; |
285 } | 286 } |
286 | 287 |
287 server_socket.StopListening(); | 288 server_socket.StopListening(); |
288 PASS(); | 289 PASS(); |
289 } | 290 } |
OLD | NEW |