Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef PPAPI_TESTS_TEST_TCP_SERVER_SOCKET_PRIVATE_H_ | |
| 6 #define PPAPI_TESTS_TEST_TCP_SERVER_SOCKET_PRIVATE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "ppapi/c/pp_stdint.h" | |
| 11 #include "ppapi/c/private/ppb_net_address_private.h" | |
| 12 #include "ppapi/c/private/ppb_tcp_server_socket_private.h" | |
| 13 #include "ppapi/c/private/ppb_tcp_socket_private.h" | |
| 14 #include "ppapi/tests/test_case.h" | |
| 15 | |
| 16 class TestTCPServerSocketPrivate : public TestCase { | |
| 17 public: | |
| 18 // TODO (ygorshenin): avoid usage of fixed ports, add dynamic ports | |
| 19 // allocation. | |
| 20 enum { kLocalPortListenSync = 20000, | |
|
yzshen1
2012/02/09 02:31:50
Is it necessary to be in the public section, or in
ygorshenin1
2012/02/09 15:00:10
No, it's not necessary. These constants are moved
| |
| 21 kLocalPortListenAsync = 20001, | |
| 22 kLocalPortBacklogSync = 20002, | |
| 23 kLocalPortBacklogAsync = 20003 }; | |
| 24 | |
| 25 explicit TestTCPServerSocketPrivate(TestingInstance* instance); | |
| 26 | |
| 27 // TestCase implementation. | |
| 28 virtual bool Init(); | |
| 29 virtual void RunTests(const std::string& filter); | |
| 30 | |
| 31 private: | |
| 32 std::string GetLocalAddress(uint16_t port, PP_NetAddress_Private* address); | |
| 33 std::string SyncCreate(PP_Instance instance, PP_Resource* tcp_server_socket); | |
| 34 std::string SyncRead(PP_Resource socket, char* buffer, int32_t num_bytes); | |
| 35 std::string SyncWrite(PP_Resource socket, | |
| 36 const char* buffer, | |
| 37 int32_t num_bytes); | |
| 38 std::string SyncConnect(PP_Resource socket, const char* host, uint16_t port); | |
| 39 void ForceConnect(PP_Resource socket, const char* host, uint16_t port); | |
| 40 std::string SyncListen(PP_Resource socket, uint16_t port, int32_t backlog); | |
| 41 | |
| 42 bool IsSocketsConnected(PP_Resource lhs, PP_Resource rhs); | |
| 43 std::string SendMessage(PP_Resource dst, | |
| 44 PP_Resource src, | |
| 45 const char* message); | |
| 46 std::string TestConnectedSockets(PP_Resource lhs, PP_Resource rhs); | |
| 47 | |
| 48 std::string CheckIOOfConnectedSockets(PP_Resource src, PP_Resource dst); | |
| 49 std::string CheckAddressesOfConnectedSockets(PP_Resource lhs, | |
| 50 PP_Resource rhs); | |
| 51 | |
| 52 std::string TestCreate(); | |
| 53 std::string TestListen(); | |
| 54 std::string TestBacklog(); | |
| 55 | |
| 56 const PPB_TCPServerSocket_Private* tcp_server_socket_private_interface_; | |
| 57 const PPB_TCPSocket_Private* tcp_socket_private_interface_; | |
| 58 std::string host_; | |
| 59 uint16_t port_; | |
| 60 }; | |
| 61 | |
| 62 #endif // PPAPI_TESTS_TEST_TCP_SERVER_SOCKET_PRIVATE_H_ | |
| OLD | NEW |