Update V8 to version 4.7.21.
[chromium-blink-merge.git] / ppapi / tests / test_tcp_socket.h
blob8f7e2f412672fdf0167d711c1b2b45bd5099755f
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.
5 #ifndef PAPPI_TESTS_TEST_TCP_SOCKET_H_
6 #define PAPPI_TESTS_TEST_TCP_SOCKET_H_
8 #include <string>
10 #include "ppapi/c/pp_stdint.h"
11 #include "ppapi/c/ppb_tcp_socket.h"
12 #include "ppapi/cpp/net_address.h"
13 #include "ppapi/tests/test_case.h"
15 namespace pp {
16 class TCPSocket;
19 class TestTCPSocket: public TestCase {
20 public:
21 explicit TestTCPSocket(TestingInstance* instance);
23 // TestCase implementation.
24 virtual bool Init();
25 virtual void RunTests(const std::string& filter);
27 private:
28 std::string TestConnect();
29 std::string TestReadWrite();
30 std::string TestSetOption();
31 std::string TestListen();
32 std::string TestBacklog();
33 std::string TestInterface_1_0();
35 std::string ReadFirstLineFromSocket(pp::TCPSocket* socket, std::string* s);
36 std::string ReadFirstLineFromSocket_1_0(PP_Resource socket,
37 std::string* s);
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);
42 std::string WriteToSocket_1_0(PP_Resource socket, const std::string& s);
44 std::string GetAddressToBind(pp::NetAddress* address);
45 std::string StartListen(pp::TCPSocket* socket, int32_t backlog);
47 pp::NetAddress addr_;
49 const PPB_TCPSocket_1_0* socket_interface_1_0_;
52 #endif // PAPPI_TESTS_TEST_TCP_SOCKET_H_