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 #ifndef PPAPI_TESTS_TEST_TCP_SERVER_SOCKET_PRIVATE_H_ | 5 #ifndef PPAPI_TESTS_TEST_TCP_SERVER_SOCKET_PRIVATE_H_ |
6 #define PPAPI_TESTS_TEST_TCP_SERVER_SOCKET_PRIVATE_H_ | 6 #define PPAPI_TESTS_TEST_TCP_SERVER_SOCKET_PRIVATE_H_ |
7 | 7 |
| 8 #include <cstddef> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "ppapi/c/pp_stdint.h" | 11 #include "ppapi/c/pp_stdint.h" |
11 #include "ppapi/c/ppb_core.h" | |
12 #include "ppapi/c/private/ppb_net_address_private.h" | |
13 #include "ppapi/c/private/ppb_tcp_server_socket_private.h" | |
14 #include "ppapi/c/private/ppb_tcp_socket_private.h" | |
15 #include "ppapi/tests/test_case.h" | 12 #include "ppapi/tests/test_case.h" |
16 | 13 |
| 14 struct PP_NetAddress_Private; |
| 15 |
| 16 namespace pp { |
| 17 |
| 18 class TCPServerSocketPrivate; |
| 19 class TCPSocketPrivate; |
| 20 |
| 21 } // namespace pp |
| 22 |
17 class TestTCPServerSocketPrivate : public TestCase { | 23 class TestTCPServerSocketPrivate : public TestCase { |
18 public: | 24 public: |
19 explicit TestTCPServerSocketPrivate(TestingInstance* instance); | 25 explicit TestTCPServerSocketPrivate(TestingInstance* instance); |
20 | 26 |
21 // TestCase implementation. | 27 // TestCase implementation. |
22 virtual bool Init(); | 28 virtual bool Init(); |
23 virtual void RunTests(const std::string& filter); | 29 virtual void RunTests(const std::string& filter); |
24 | 30 |
25 private: | 31 private: |
26 std::string GetLocalAddress(PP_NetAddress_Private* address); | 32 std::string SyncRead(pp::TCPSocketPrivate* socket, |
27 std::string SyncRead(PP_Resource socket, char* buffer, int32_t num_bytes); | 33 char* buffer, |
28 std::string SyncWrite(PP_Resource socket, | 34 size_t num_bytes); |
| 35 std::string SyncWrite(pp::TCPSocketPrivate* socket, |
29 const char* buffer, | 36 const char* buffer, |
30 int32_t num_bytes); | 37 size_t num_bytes); |
31 std::string SyncConnect(PP_Resource socket, const char* host, uint16_t port); | 38 std::string SyncConnect(pp::TCPSocketPrivate* socket, |
32 void ForceConnect(PP_Resource socket, const char* host, uint16_t port); | 39 PP_NetAddress_Private* address); |
33 std::string SyncListen(PP_Resource socket, uint16_t* port, int32_t backlog); | 40 void ForceConnect(pp::TCPSocketPrivate* socket, |
| 41 PP_NetAddress_Private* address); |
| 42 std::string SyncListen(pp::TCPServerSocketPrivate* socket, |
| 43 PP_NetAddress_Private* address, |
| 44 int32_t backlog); |
34 | 45 |
35 bool IsSocketsConnected(PP_Resource lhs, PP_Resource rhs); | |
36 std::string SendMessage(PP_Resource dst, | |
37 PP_Resource src, | |
38 const char* message); | |
39 std::string TestConnectedSockets(PP_Resource lhs, PP_Resource rhs); | |
40 | |
41 std::string CheckIOOfConnectedSockets(PP_Resource src, PP_Resource dst); | |
42 std::string CheckAddressesOfConnectedSockets(PP_Resource lhs, | |
43 PP_Resource rhs); | |
44 | |
45 std::string TestCreate(); | |
46 std::string TestListen(); | 46 std::string TestListen(); |
47 std::string TestBacklog(); | 47 std::string TestBacklog(); |
48 | |
49 const PPB_Core* core_interface_; | |
50 const PPB_TCPServerSocket_Private* tcp_server_socket_private_interface_; | |
51 const PPB_TCPSocket_Private* tcp_socket_private_interface_; | |
52 std::string host_; | |
53 uint16_t port_; | |
54 }; | 48 }; |
55 | 49 |
56 #endif // PPAPI_TESTS_TEST_TCP_SERVER_SOCKET_PRIVATE_H_ | 50 #endif // PPAPI_TESTS_TEST_TCP_SERVER_SOCKET_PRIVATE_H_ |
OLD | NEW |