OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef PPAPI_TESTS_TEST_UDP_SOCKET_H_ | 5 #ifndef PPAPI_TESTS_TEST_UDP_SOCKET_H_ |
6 #define PPAPI_TESTS_TEST_UDP_SOCKET_H_ | 6 #define PPAPI_TESTS_TEST_UDP_SOCKET_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ppapi/c/pp_stdint.h" | 10 #include "ppapi/c/pp_stdint.h" |
11 #include "ppapi/c/ppb_udp_socket.h" | |
11 #include "ppapi/cpp/net_address.h" | 12 #include "ppapi/cpp/net_address.h" |
12 #include "ppapi/tests/test_case.h" | 13 #include "ppapi/tests/test_case.h" |
13 | 14 |
15 namespace { | |
16 typedef int32_t (*UDPSocketSetOption)(PP_Resource udp_socket, | |
dcheng
2015/03/09 21:14:33
We prefer using foo = bar; to typedefs (http://chr
etrunko
2015/03/09 22:18:10
If I change it, the code fails to build. I think t
| |
17 PP_UDPSocket_Option name, | |
18 struct PP_Var value, | |
19 struct PP_CompletionCallback callback); | |
20 } | |
21 | |
14 namespace pp { | 22 namespace pp { |
15 class UDPSocket; | 23 class UDPSocket; |
16 } | 24 } |
17 | 25 |
18 class TestUDPSocket: public TestCase { | 26 class TestUDPSocket: public TestCase { |
19 public: | 27 public: |
20 explicit TestUDPSocket(TestingInstance* instance); | 28 explicit TestUDPSocket(TestingInstance* instance); |
21 | 29 |
22 // TestCase implementation. | 30 // TestCase implementation. |
23 virtual bool Init(); | 31 virtual bool Init(); |
24 virtual void RunTests(const std::string& filter); | 32 virtual void RunTests(const std::string& filter); |
25 | 33 |
26 private: | 34 private: |
27 std::string GetLocalAddress(pp::NetAddress* address); | 35 std::string GetLocalAddress(pp::NetAddress* address); |
28 std::string SetBroadcastOptions(pp::UDPSocket* socket); | 36 std::string SetBroadcastOptions(pp::UDPSocket* socket); |
29 std::string BindUDPSocket(pp::UDPSocket* socket, | 37 std::string BindUDPSocket(pp::UDPSocket* socket, |
30 const pp::NetAddress& address); | 38 const pp::NetAddress& address); |
31 std::string LookupPortAndBindUDPSocket(pp::UDPSocket* socket, | 39 std::string LookupPortAndBindUDPSocket(pp::UDPSocket* socket, |
32 pp::NetAddress* address); | 40 pp::NetAddress* address); |
33 std::string ReadSocket(pp::UDPSocket* socket, | 41 std::string ReadSocket(pp::UDPSocket* socket, |
34 pp::NetAddress* address, | 42 pp::NetAddress* address, |
35 size_t size, | 43 size_t size, |
36 std::string* message); | 44 std::string* message); |
37 std::string PassMessage(pp::UDPSocket* target, | 45 std::string PassMessage(pp::UDPSocket* target, |
38 pp::UDPSocket* source, | 46 pp::UDPSocket* source, |
39 const pp::NetAddress& target_address, | 47 const pp::NetAddress& target_address, |
40 const std::string& message, | 48 const std::string& message, |
41 pp::NetAddress* recvfrom_address); | 49 pp::NetAddress* recvfrom_address); |
50 std::string SetMulticastOptions(pp::UDPSocket* socket); | |
42 | 51 |
43 std::string TestReadWrite(); | 52 std::string TestReadWrite(); |
44 std::string TestBroadcast(); | 53 std::string TestBroadcast(); |
54 int32_t SetOptionValue(UDPSocketSetOption func, | |
55 PP_Resource socket, | |
56 PP_UDPSocket_Option option, | |
57 PP_Var value); | |
58 std::string TestSetOption_1_0(); | |
59 std::string TestSetOption_1_1(); | |
45 std::string TestSetOption(); | 60 std::string TestSetOption(); |
46 std::string TestParallelSend(); | 61 std::string TestParallelSend(); |
62 std::string TestMulticast(); | |
47 | 63 |
48 pp::NetAddress address_; | 64 pp::NetAddress address_; |
65 | |
66 const PPB_UDPSocket_1_0* socket_interface_1_0_; | |
67 const PPB_UDPSocket_1_1* socket_interface_1_1_; | |
68 bool has_interface_1_2_; | |
49 }; | 69 }; |
50 | 70 |
51 #endif // PPAPI_TESTS_TEST_UDP_SOCKET_H_ | 71 #endif // PPAPI_TESTS_TEST_UDP_SOCKET_H_ |
OLD | NEW |