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_HOST_RESOLVER_PRIVATE_H_ 6 #define PPAPI_TESTS_TEST_HOST_RESOLVER_PRIVATE_H_ 7 8 #include <string> 9 10 #include "ppapi/tests/test_case.h" 11 12 struct PP_HostResolver_Private_Hint; 13 struct PP_NetAddress_Private; 14 15 namespace pp { 16 17 class HostResolverPrivate; 18 class TCPSocketPrivate; 19 20 } // namespace pp 21 22 class TestHostResolverPrivate : public TestCase { 23 public: 24 explicit TestHostResolverPrivate(TestingInstance* instance); 25 26 // TestCase implementation. 27 virtual bool Init(); 28 virtual void RunTests(const std::string& filter); 29 30 private: 31 std::string SyncConnect(pp::TCPSocketPrivate* socket, 32 const std::string& host, 33 uint16_t port); 34 std::string SyncConnect(pp::TCPSocketPrivate* socket, 35 const PP_NetAddress_Private& address); 36 std::string SyncRead(pp::TCPSocketPrivate* socket, 37 char* buffer, 38 int32_t num_bytes, 39 int32_t* bytes_read); 40 std::string SyncWrite(pp::TCPSocketPrivate* socket, 41 const char* buffer, 42 int32_t num_bytes, 43 int32_t* bytes_written); 44 std::string CheckHTTPResponse(pp::TCPSocketPrivate* socket, 45 const std::string& request, 46 const std::string& response); 47 std::string SyncResolve(pp::HostResolverPrivate* host_resolver, 48 const std::string& host, 49 uint16_t port, 50 const PP_HostResolver_Private_Hint& hint); 51 std::string ParametrizedTestResolve(const PP_HostResolver_Private_Hint& hint); 52 53 std::string TestEmpty(); 54 std::string TestResolve(); 55 std::string TestResolveIPv4(); 56 57 std::string host_; 58 uint16_t port_; 59 }; 60 61 #endif // PPAPI_TESTS_TEST_HOST_RESOLVER_PRIVATE_H_ 62