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.
5 #ifndef PAPPI_TESTS_TEST_WEBSOCKET_H_
6 #define PAPPI_TESTS_TEST_WEBSOCKET_H_
10 #include "ppapi/c/ppb_core.h"
11 #include "ppapi/c/ppb_var.h"
12 #include "ppapi/c/ppb_var_array_buffer.h"
13 #include "ppapi/c/ppb_websocket.h"
14 #include "ppapi/tests/test_case.h"
16 class TestWebSocket
: public TestCase
{
18 explicit TestWebSocket(TestingInstance
* instance
) : TestCase(instance
) {}
21 // TestCase implementation.
23 virtual void RunTests(const std::string
& filter
);
25 std::string
GetFullURL(const char* url
);
26 PP_Var
CreateVarString(const std::string
& string
);
27 PP_Var
CreateVarBinary(const std::vector
<uint8_t>& binary
);
28 void ReleaseVar(const PP_Var
& var
);
29 bool AreEqualWithString(const PP_Var
& var
, const std::string
& string
);
30 bool AreEqualWithBinary(const PP_Var
& var
,
31 const std::vector
<uint8_t>& binary
);
33 PP_Resource
Connect(const std::string
& url
,
35 const std::string
& protocol
);
37 std::string
TestIsWebSocket();
38 std::string
TestUninitializedPropertiesAccess();
39 std::string
TestInvalidConnect();
40 std::string
TestProtocols();
41 std::string
TestGetURL();
42 std::string
TestValidConnect();
43 std::string
TestInvalidClose();
44 std::string
TestValidClose();
45 std::string
TestGetProtocol();
46 std::string
TestTextSendReceive();
47 std::string
TestBinarySendReceive();
48 std::string
TestStressedSendReceive();
49 std::string
TestBufferedAmount();
50 std::string
TestAbortCallsWithCallback();
51 std::string
TestAbortSendMessageCall();
52 std::string
TestAbortCloseCall();
53 std::string
TestAbortReceiveMessageCall();
55 std::string
TestCcInterfaces();
57 std::string
TestUtilityInvalidConnect();
58 std::string
TestUtilityProtocols();
59 std::string
TestUtilityGetURL();
60 std::string
TestUtilityValidConnect();
61 std::string
TestUtilityInvalidClose();
62 std::string
TestUtilityValidClose();
63 std::string
TestUtilityGetProtocol();
64 std::string
TestUtilityTextSendReceive();
65 std::string
TestUtilityBinarySendReceive();
66 std::string
TestUtilityBufferedAmount();
68 // Keeps Pepper API interfaces. These are used by the tests that access the C
70 const PPB_WebSocket
* websocket_interface_
;
71 const PPB_Var
* var_interface_
;
72 const PPB_VarArrayBuffer
* arraybuffer_interface_
;
73 const PPB_Core
* core_interface_
;
76 #endif // PAPPI_TESTS_TEST_WEBSOCKET_H_