blob: 8f7e2f412672fdf0167d711c1b2b45bd5099755f [file] [log] [blame]
[email protected]b1784f42013-06-13 06:48:361// 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]76192902013-10-02 21:56:1111#include "ppapi/c/ppb_tcp_socket.h"
[email protected]ee517552013-06-22 20:07:5012#include "ppapi/cpp/net_address.h"
[email protected]b1784f42013-06-13 06:48:3613#include "ppapi/tests/test_case.h"
14
15namespace pp {
[email protected]b838eea2013-06-22 22:17:2216class TCPSocket;
[email protected]b1784f42013-06-13 06:48:3617}
18
19class 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]92576792013-09-20 15:29:1331 std::string TestListen();
32 std::string TestBacklog();
[email protected]76192902013-10-02 21:56:1133 std::string TestInterface_1_0();
[email protected]b1784f42013-06-13 06:48:3634
[email protected]92576792013-09-20 15:29:1335 std::string ReadFirstLineFromSocket(pp::TCPSocket* socket, std::string* s);
[email protected]76192902013-10-02 21:56:1136 std::string ReadFirstLineFromSocket_1_0(PP_Resource socket,
37 std::string* s);
[email protected]92576792013-09-20 15:29:1338 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]76192902013-10-02 21:56:1142 std::string WriteToSocket_1_0(PP_Resource socket, const std::string& s);
43
[email protected]92576792013-09-20 15:29:1344 std::string GetAddressToBind(pp::NetAddress* address);
45 std::string StartListen(pp::TCPSocket* socket, int32_t backlog);
[email protected]b1784f42013-06-13 06:48:3646
[email protected]ee517552013-06-22 20:07:5047 pp::NetAddress addr_;
[email protected]76192902013-10-02 21:56:1148
49 const PPB_TCPSocket_1_0* socket_interface_1_0_;
[email protected]b1784f42013-06-13 06:48:3650};
51
52#endif // PAPPI_TESTS_TEST_TCP_SOCKET_H_