[email protected] | b1784f4 | 2013-06-13 06:48:36 | [diff] [blame] | 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. | ||||
4 | |||||
5 | #ifndef PAPPI_TESTS_TEST_TCP_SOCKET_H_ | ||||
6 | #define PAPPI_TESTS_TEST_TCP_SOCKET_H_ | ||||
7 | |||||
8 | #include <string> | ||||
9 | |||||
10 | #include "ppapi/c/pp_stdint.h" | ||||
[email protected] | 7619290 | 2013-10-02 21:56:11 | [diff] [blame] | 11 | #include "ppapi/c/ppb_tcp_socket.h" |
[email protected] | ee51755 | 2013-06-22 20:07:50 | [diff] [blame] | 12 | #include "ppapi/cpp/net_address.h" |
[email protected] | b1784f4 | 2013-06-13 06:48:36 | [diff] [blame] | 13 | #include "ppapi/tests/test_case.h" |
14 | |||||
15 | namespace pp { | ||||
[email protected] | b838eea | 2013-06-22 22:17:22 | [diff] [blame] | 16 | class TCPSocket; |
[email protected] | b1784f4 | 2013-06-13 06:48:36 | [diff] [blame] | 17 | } |
18 | |||||
19 | class TestTCPSocket: public TestCase { | ||||
20 | public: | ||||
21 | explicit TestTCPSocket(TestingInstance* instance); | ||||
22 | |||||
23 | // TestCase implementation. | ||||
24 | virtual bool Init(); | ||||
25 | virtual void RunTests(const std::string& filter); | ||||
26 | |||||
27 | private: | ||||
28 | std::string TestConnect(); | ||||
29 | std::string TestReadWrite(); | ||||
30 | std::string TestSetOption(); | ||||
[email protected] | 9257679 | 2013-09-20 15:29:13 | [diff] [blame] | 31 | std::string TestListen(); |
32 | std::string TestBacklog(); | ||||
[email protected] | 7619290 | 2013-10-02 21:56:11 | [diff] [blame] | 33 | std::string TestInterface_1_0(); |
[email protected] | b1784f4 | 2013-06-13 06:48:36 | [diff] [blame] | 34 | |
[email protected] | 9257679 | 2013-09-20 15:29:13 | [diff] [blame] | 35 | std::string ReadFirstLineFromSocket(pp::TCPSocket* socket, std::string* s); |
[email protected] | 7619290 | 2013-10-02 21:56:11 | [diff] [blame] | 36 | std::string ReadFirstLineFromSocket_1_0(PP_Resource socket, |
37 | std::string* s); | ||||
[email protected] | 9257679 | 2013-09-20 15:29:13 | [diff] [blame] | 38 | std::string ReadFromSocket(pp::TCPSocket* socket, |
39 | char* buffer, | ||||
40 | size_t num_bytes); | ||||
41 | std::string WriteToSocket(pp::TCPSocket* socket, const std::string& s); | ||||
[email protected] | 7619290 | 2013-10-02 21:56:11 | [diff] [blame] | 42 | std::string WriteToSocket_1_0(PP_Resource socket, const std::string& s); |
43 | |||||
[email protected] | 9257679 | 2013-09-20 15:29:13 | [diff] [blame] | 44 | std::string GetAddressToBind(pp::NetAddress* address); |
45 | std::string StartListen(pp::TCPSocket* socket, int32_t backlog); | ||||
[email protected] | b1784f4 | 2013-06-13 06:48:36 | [diff] [blame] | 46 | |
[email protected] | ee51755 | 2013-06-22 20:07:50 | [diff] [blame] | 47 | pp::NetAddress addr_; |
[email protected] | 7619290 | 2013-10-02 21:56:11 | [diff] [blame] | 48 | |
49 | const PPB_TCPSocket_1_0* socket_interface_1_0_; | ||||
[email protected] | b1784f4 | 2013-06-13 06:48:36 | [diff] [blame] | 50 | }; |
51 | |||||
52 | #endif // PAPPI_TESTS_TEST_TCP_SOCKET_H_ |