1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PPAPI_TESTS_TEST_UDP_SOCKET_H_
6 #define PPAPI_TESTS_TEST_UDP_SOCKET_H_
10 #include "ppapi/c/pp_stdint.h"
11 #include "ppapi/c/ppb_udp_socket.h"
12 #include "ppapi/cpp/net_address.h"
13 #include "ppapi/tests/test_case.h"
16 typedef int32_t (*UDPSocketSetOption
)(PP_Resource udp_socket
,
17 PP_UDPSocket_Option name
,
19 struct PP_CompletionCallback callback
);
26 class TestUDPSocket
: public TestCase
{
28 explicit TestUDPSocket(TestingInstance
* instance
);
30 // TestCase implementation.
32 virtual void RunTests(const std::string
& filter
);
35 std::string
GetLocalAddress(pp::NetAddress
* address
);
36 std::string
SetBroadcastOptions(pp::UDPSocket
* socket
);
37 std::string
BindUDPSocket(pp::UDPSocket
* socket
,
38 const pp::NetAddress
& address
);
39 std::string
LookupPortAndBindUDPSocket(pp::UDPSocket
* socket
,
40 pp::NetAddress
* address
);
41 std::string
ReadSocket(pp::UDPSocket
* socket
,
42 pp::NetAddress
* address
,
44 std::string
* message
);
45 std::string
PassMessage(pp::UDPSocket
* target
,
46 pp::UDPSocket
* source
,
47 const pp::NetAddress
& target_address
,
48 const std::string
& message
,
49 pp::NetAddress
* recvfrom_address
);
50 std::string
SetMulticastOptions(pp::UDPSocket
* socket
);
52 std::string
TestReadWrite();
53 std::string
TestBroadcast();
54 int32_t SetOptionValue(UDPSocketSetOption func
,
56 PP_UDPSocket_Option option
,
58 std::string
TestSetOption_1_0();
59 std::string
TestSetOption_1_1();
60 std::string
TestSetOption();
61 std::string
TestParallelSend();
62 std::string
TestMulticast();
64 pp::NetAddress address_
;
66 const PPB_UDPSocket_1_0
* socket_interface_1_0_
;
67 const PPB_UDPSocket_1_1
* socket_interface_1_1_
;
70 #endif // PPAPI_TESTS_TEST_UDP_SOCKET_H_