| 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 <cstring> | 5 #include <cstring> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "ppapi/cpp/module.h" | 8 #include "ppapi/cpp/module.h" |
| 9 #include "ppapi/cpp/private/net_address_private.h" | 9 #include "ppapi/cpp/private/net_address_private.h" |
| 10 #include "ppapi/cpp/private/tcp_socket_private.h" | 10 #include "ppapi/cpp/private/tcp_socket_private.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 socket.Connect(host_.c_str(), port_, callback.GetCallback())); | 68 socket.Connect(host_.c_str(), port_, callback.GetCallback())); |
| 69 CHECK_CALLBACK_BEHAVIOR(callback); | 69 CHECK_CALLBACK_BEHAVIOR(callback); |
| 70 ASSERT_EQ(PP_OK, callback.result()); | 70 ASSERT_EQ(PP_OK, callback.result()); |
| 71 ASSERT_TRUE(socket.GetLocalAddress(address)); | 71 ASSERT_TRUE(socket.GetLocalAddress(address)); |
| 72 socket.Disconnect(); | 72 socket.Disconnect(); |
| 73 PASS(); | 73 PASS(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 std::string TestUDPSocketPrivate::SetBroadcastOptions( | 76 std::string TestUDPSocketPrivate::SetBroadcastOptions( |
| 77 pp::UDPSocketPrivate* socket) { | 77 pp::UDPSocketPrivate* socket) { |
| 78 int32_t rv = socket->SetSocketFeature(PP_UDPSOCKETFEATURE_ADDRESS_REUSE, | 78 int32_t rv = socket->SetSocketFeature( |
| 79 pp::Var(true)); | 79 PP_UDPSOCKETFEATURE_PRIVATE_ADDRESS_REUSE, pp::Var(true)); |
| 80 if (rv != PP_OK) | 80 if (rv != PP_OK) |
| 81 return ReportError("PPB_UDPSocket_Private::SetSocketFeature", rv); | 81 return ReportError("PPB_UDPSocket_Private::SetSocketFeature", rv); |
| 82 | 82 |
| 83 rv = socket->SetSocketFeature(PP_UDPSOCKETFEATURE_BROADCAST, pp::Var(true)); | 83 rv = socket->SetSocketFeature(PP_UDPSOCKETFEATURE_PRIVATE_BROADCAST, |
| 84 pp::Var(true)); |
| 84 if (rv != PP_OK) | 85 if (rv != PP_OK) |
| 85 return ReportError("PPB_UDPSocket_Private::SetSocketFeature", rv); | 86 return ReportError("PPB_UDPSocket_Private::SetSocketFeature", rv); |
| 86 | 87 |
| 87 PASS(); | 88 PASS(); |
| 88 } | 89 } |
| 89 | 90 |
| 90 std::string TestUDPSocketPrivate::BindUDPSocket( | 91 std::string TestUDPSocketPrivate::BindUDPSocket( |
| 91 pp::UDPSocketPrivate* socket, | 92 pp::UDPSocketPrivate* socket, |
| 92 PP_NetAddress_Private* address) { | 93 PP_NetAddress_Private* address) { |
| 93 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); | 94 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 ASSERT_EQ(second_message, message); | 240 ASSERT_EQ(second_message, message); |
| 240 | 241 |
| 241 server1.Close(); | 242 server1.Close(); |
| 242 server2.Close(); | 243 server2.Close(); |
| 243 PASS(); | 244 PASS(); |
| 244 } | 245 } |
| 245 | 246 |
| 246 std::string TestUDPSocketPrivate::TestSetSocketFeatureErrors() { | 247 std::string TestUDPSocketPrivate::TestSetSocketFeatureErrors() { |
| 247 pp::UDPSocketPrivate socket(instance_); | 248 pp::UDPSocketPrivate socket(instance_); |
| 248 // Try to pass incorrect feature name. | 249 // Try to pass incorrect feature name. |
| 249 int32_t rv = socket.SetSocketFeature(PP_UDPSOCKETFEATURE_COUNT, | 250 int32_t rv = socket.SetSocketFeature(PP_UDPSOCKETFEATURE_PRIVATE_COUNT, |
| 250 pp::Var(true)); | 251 pp::Var(true)); |
| 251 ASSERT_EQ(PP_ERROR_BADARGUMENT, rv); | 252 ASSERT_EQ(PP_ERROR_BADARGUMENT, rv); |
| 252 | 253 |
| 253 // Try to pass incorrect feature value's type. | 254 // Try to pass incorrect feature value's type. |
| 254 rv = socket.SetSocketFeature(PP_UDPSOCKETFEATURE_ADDRESS_REUSE, pp::Var(1)); | 255 rv = socket.SetSocketFeature(PP_UDPSOCKETFEATURE_PRIVATE_ADDRESS_REUSE, |
| 256 pp::Var(1)); |
| 255 ASSERT_EQ(PP_ERROR_BADARGUMENT, rv); | 257 ASSERT_EQ(PP_ERROR_BADARGUMENT, rv); |
| 256 PASS(); | 258 PASS(); |
| 257 } | 259 } |
| OLD | NEW |