| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string.h> | 5 #include <string.h> |
| 6 | 6 |
| 7 #include "ppapi/cpp/module.h" | 7 #include "ppapi/cpp/module.h" |
| 8 #include "ppapi/tests/test_udp_socket_private_shared.h" | 8 #include "ppapi/tests/test_udp_socket_private_shared.h" |
| 9 #include "ppapi/tests/test_utils.h" | 9 #include "ppapi/tests/test_utils.h" |
| 10 #include "ppapi/tests/testing_instance.h" | 10 #include "ppapi/tests/testing_instance.h" |
| 11 | 11 |
| 12 REGISTER_TEST_CASE(UDPSocketPrivateShared); | 12 REGISTER_TEST_CASE(UDPSocketPrivateShared); |
| 13 | 13 |
| 14 // TODO(ygorshenin): get rid of using external server in tests, | 14 // TODO(ygorshenin): get rid of using external server in tests, |
| 15 // http://crbug.com/105863 | 15 // http://crbug.com/105863 |
| 16 const char* const TestUDPSocketPrivateShared::kHost = "www.google.com"; | 16 const char* const TestUDPSocketPrivateShared::kHost = "www.google.com"; |
| 17 | 17 |
| 18 TestUDPSocketPrivateShared::TestUDPSocketPrivateShared( | 18 TestUDPSocketPrivateShared::TestUDPSocketPrivateShared( |
| 19 TestingInstance* instance) | 19 TestingInstance* instance) |
| 20 : TestCase(instance), | 20 : TestCase(instance), |
| 21 tcp_socket_private_interface_(NULL), | 21 tcp_socket_private_interface_(NULL), |
| 22 udp_socket_private_interface_(NULL) { | 22 udp_socket_private_interface_(NULL) { |
| 23 } | 23 } |
| 24 | 24 |
| 25 bool TestUDPSocketPrivateShared::Init() { | 25 bool TestUDPSocketPrivateShared::Init() { |
| 26 tcp_socket_private_interface_ = | 26 tcp_socket_private_interface_ = static_cast<const PPB_TCPSocket_Private*>( |
| 27 reinterpret_cast<PPB_TCPSocket_Private const*>( | 27 pp::Module::Get()->GetBrowserInterface(PPB_TCPSOCKET_PRIVATE_INTERFACE)); |
| 28 pp::Module::Get()->GetBrowserInterface( | |
| 29 PPB_TCPSOCKET_PRIVATE_INTERFACE)); | |
| 30 if (!tcp_socket_private_interface_) | 28 if (!tcp_socket_private_interface_) |
| 31 instance_->AppendError("TCPSocketPrivate interface not available"); | 29 instance_->AppendError("TCPSocketPrivate interface not available"); |
| 32 | 30 |
| 33 udp_socket_private_interface_ = | 31 udp_socket_private_interface_ = static_cast<const PPB_UDPSocket_Private*>( |
| 34 reinterpret_cast<PPB_UDPSocket_Private const*>( | 32 pp::Module::Get()->GetBrowserInterface(PPB_UDPSOCKET_PRIVATE_INTERFACE)); |
| 35 pp::Module::Get()->GetBrowserInterface( | |
| 36 PPB_UDPSOCKET_PRIVATE_INTERFACE)); | |
| 37 if (!udp_socket_private_interface_) | 33 if (!udp_socket_private_interface_) |
| 38 instance_->AppendError("UDPSocketPrivate interface not available"); | 34 instance_->AppendError("UDPSocketPrivate interface not available"); |
| 39 | 35 |
| 40 return tcp_socket_private_interface_ && udp_socket_private_interface_ && | 36 return tcp_socket_private_interface_ && udp_socket_private_interface_ && |
| 41 InitTestingInterface(); | 37 InitTestingInterface(); |
| 42 } | 38 } |
| 43 | 39 |
| 44 void TestUDPSocketPrivateShared::RunTests(const std::string& filter) { | 40 void TestUDPSocketPrivateShared::RunTests(const std::string& filter) { |
| 45 RUN_TEST(Create, filter); | 41 RUN_TEST(Create, filter); |
| 46 RUN_TEST_FORCEASYNC_AND_NOT(Connect, filter); | 42 RUN_TEST_FORCEASYNC_AND_NOT(Connect, filter); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 ASSERT_EQ(0, strncmp(kMessage, message_buffer, strlen(kMessage))); | 169 ASSERT_EQ(0, strncmp(kMessage, message_buffer, strlen(kMessage))); |
| 174 | 170 |
| 175 udp_socket_private_interface_->Close(socket_server); | 171 udp_socket_private_interface_->Close(socket_server); |
| 176 udp_socket_private_interface_->Close(socket_client); | 172 udp_socket_private_interface_->Close(socket_client); |
| 177 | 173 |
| 178 tcp_socket_private_interface_->Disconnect(tcp_socket_server); | 174 tcp_socket_private_interface_->Disconnect(tcp_socket_server); |
| 179 tcp_socket_private_interface_->Disconnect(tcp_socket_client); | 175 tcp_socket_private_interface_->Disconnect(tcp_socket_client); |
| 180 | 176 |
| 181 PASS(); | 177 PASS(); |
| 182 } | 178 } |
| OLD | NEW |