Home | History | Annotate | Download | only in tests
      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 <cstddef>
      9 #include <string>
     10 
     11 #include "ppapi/c/pp_stdint.h"
     12 #include "ppapi/tests/test_case.h"
     13 
     14 struct PP_NetAddress_Private;
     15 
     16 namespace pp {
     17 
     18 class TCPServerSocketPrivate;
     19 class TCPSocketPrivate;
     20 
     21 }  // namespace pp
     22 
     23 class TestTCPServerSocketPrivate : public TestCase {
     24  public:
     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(PP_NetAddress_Private* address);
     33   std::string SyncRead(pp::TCPSocketPrivate* socket,
     34                        char* buffer,
     35                        size_t num_bytes);
     36   std::string SyncWrite(pp::TCPSocketPrivate* socket,
     37                         const char* buffer,
     38                         size_t num_bytes);
     39   std::string SyncConnect(pp::TCPSocketPrivate* socket,
     40                           PP_NetAddress_Private* address);
     41   void ForceConnect(pp::TCPSocketPrivate* socket,
     42                     PP_NetAddress_Private* address);
     43   std::string SyncListen(pp::TCPServerSocketPrivate* socket,
     44                          PP_NetAddress_Private* address,
     45                          int32_t backlog);
     46 
     47   std::string TestListen();
     48   std::string TestBacklog();
     49 
     50   std::string host_;
     51   uint16_t port_;
     52 };
     53 
     54 #endif  // PPAPI_TESTS_TEST_TCP_SERVER_SOCKET_PRIVATE_H_
     55