| 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 PAPPI_TESTS_TEST_TCP_SOCKET_H_ | 5 #ifndef PAPPI_TESTS_TEST_TCP_SOCKET_H_ |
| 6 #define PAPPI_TESTS_TEST_TCP_SOCKET_H_ | 6 #define PAPPI_TESTS_TEST_TCP_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/cpp/net_address.h" | 11 #include "ppapi/cpp/net_address.h" |
| 12 #include "ppapi/tests/test_case.h" | 12 #include "ppapi/tests/test_case.h" |
| 13 | 13 |
| 14 namespace pp { | 14 namespace pp { |
| 15 class TCPSocket; | 15 class TCPSocket; |
| 16 } | 16 } |
| 17 | 17 |
| 18 class TestTCPSocket: public TestCase { | 18 class TestTCPSocket: public TestCase { |
| 19 public: | 19 public: |
| 20 explicit TestTCPSocket(TestingInstance* instance); | 20 explicit TestTCPSocket(TestingInstance* instance); |
| 21 | 21 |
| 22 // TestCase implementation. | 22 // TestCase implementation. |
| 23 virtual bool Init(); | 23 virtual bool Init(); |
| 24 virtual void RunTests(const std::string& filter); | 24 virtual void RunTests(const std::string& filter); |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 std::string TestConnect(); | 27 std::string TestConnect(); |
| 28 std::string TestReadWrite(); | 28 std::string TestReadWrite(); |
| 29 std::string TestSetOption(); | 29 std::string TestSetOption(); |
| 30 std::string TestListen(); |
| 31 std::string TestBacklog(); |
| 30 | 32 |
| 31 int32_t ReadFirstLineFromSocket(pp::TCPSocket* socket, std::string* s); | 33 std::string ReadFirstLineFromSocket(pp::TCPSocket* socket, std::string* s); |
| 32 int32_t WriteStringToSocket(pp::TCPSocket* socket, const std::string& s); | 34 std::string ReadFromSocket(pp::TCPSocket* socket, |
| 35 char* buffer, |
| 36 size_t num_bytes); |
| 37 std::string WriteToSocket(pp::TCPSocket* socket, const std::string& s); |
| 38 std::string GetAddressToBind(pp::NetAddress* address); |
| 39 std::string StartListen(pp::TCPSocket* socket, int32_t backlog); |
| 33 | 40 |
| 34 pp::NetAddress addr_; | 41 pp::NetAddress addr_; |
| 35 }; | 42 }; |
| 36 | 43 |
| 37 #endif // PAPPI_TESTS_TEST_TCP_SOCKET_H_ | 44 #endif // PAPPI_TESTS_TEST_TCP_SOCKET_H_ |
| OLD | NEW |