OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 PPAPI_TESTS_TEST_TCP_SOCKET_PRIVATE_SHARED_H_ | 5 #ifndef PPAPI_TESTS_TEST_TCP_SOCKET_PRIVATE_SHARED_H_ |
6 #define PPAPI_TESTS_TEST_TCP_SOCKET_PRIVATE_SHARED_H_ | 6 #define PPAPI_TESTS_TEST_TCP_SOCKET_PRIVATE_SHARED_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/private/tcp_socket_private.h" | 11 #include "ppapi/cpp/private/tcp_socket_private.h" |
12 #include "ppapi/tests/test_case.h" | 12 #include "ppapi/tests/test_case.h" |
13 | 13 |
14 class TestTCPSocketPrivateShared : public TestCase { | 14 class TestTCPSocketPrivateShared : public TestCase { |
15 public: | 15 public: |
16 explicit TestTCPSocketPrivateShared(TestingInstance* instance); | 16 explicit TestTCPSocketPrivateShared(TestingInstance* instance); |
17 | 17 |
18 // TestCase implementation. | 18 // TestCase implementation. |
19 virtual bool Init(); | 19 virtual bool Init(); |
20 virtual void RunTests(const std::string& filter); | 20 virtual void RunTests(const std::string& filter); |
21 | 21 |
22 void QuitMessageLoop(); | 22 void QuitMessageLoop(); |
23 | 23 |
24 private: | 24 private: |
25 static const char* const kHost; | |
26 static const int kPort = 443; | |
27 | |
28 std::string CreateSocket(PP_Resource* socket); | 25 std::string CreateSocket(PP_Resource* socket); |
29 std::string SyncConnect(PP_Resource socket, const char* host, int port); | 26 std::string SyncConnect(PP_Resource socket, |
| 27 const std::string& host, uint16_t port); |
30 std::string SyncConnectWithNetAddress(PP_Resource socket, | 28 std::string SyncConnectWithNetAddress(PP_Resource socket, |
31 const PP_NetAddress_Private& addr); | 29 const PP_NetAddress_Private& addr); |
32 std::string SyncSSLHandshake(PP_Resource socket, const char* host, int port); | |
33 std::string SyncRead(PP_Resource socket, char* buffer, int32_t num_bytes, | 30 std::string SyncRead(PP_Resource socket, char* buffer, int32_t num_bytes, |
34 int32_t* bytes_read); | 31 int32_t* bytes_read); |
35 std::string SyncWrite(PP_Resource socket, const char* buffer, | 32 std::string SyncWrite(PP_Resource socket, const char* buffer, |
36 int32_t num_bytes, int32_t* bytes_wrote); | 33 int32_t num_bytes, int32_t* bytes_wrote); |
37 std::string CheckHTTPResponse(PP_Resource socket, | 34 std::string CheckHTTPResponse(PP_Resource socket, |
38 const std::string& request, | 35 const std::string& request, |
39 const std::string& response); | 36 const std::string& response); |
40 | 37 |
41 std::string TestCreate(); | 38 std::string TestCreate(); |
42 std::string TestGetAddress(); | 39 std::string TestGetAddress(); |
43 std::string TestConnect(); | 40 std::string TestConnect(); |
44 std::string TestReconnect(); | 41 std::string TestReconnect(); |
45 | 42 |
46 const PPB_TCPSocket_Private* tcp_socket_private_interface_; | 43 const PPB_TCPSocket_Private* tcp_socket_private_interface_; |
| 44 std::string host_; |
| 45 uint16_t port_; |
47 }; | 46 }; |
48 | 47 |
49 #endif // PPAPI_TESTS_TEST_TCP_SOCKET_PRIVATE_SHARED_H_ | 48 #endif // PPAPI_TESTS_TEST_TCP_SOCKET_PRIVATE_SHARED_H_ |
OLD | NEW |