Update V8 to version 4.7.21.
[chromium-blink-merge.git] / ppapi / tests / test_websocket.h
blobeff0a5ef61d4b32871e0217b8fff882b082e40b1
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 PPAPI_TESTS_TEST_WEBSOCKET_H_
6 #define PPAPI_TESTS_TEST_WEBSOCKET_H_
8 #include <string>
9 #include <vector>
11 #include "ppapi/c/ppb_core.h"
12 #include "ppapi/c/ppb_var.h"
13 #include "ppapi/c/ppb_var_array_buffer.h"
14 #include "ppapi/c/ppb_websocket.h"
15 #include "ppapi/tests/test_case.h"
17 class TestWebSocket : public TestCase {
18 public:
19 explicit TestWebSocket(TestingInstance* instance) : TestCase(instance) {}
21 private:
22 // TestCase implementation.
23 virtual bool Init();
24 virtual void RunTests(const std::string& filter);
26 std::string GetFullURL(const char* url);
27 PP_Var CreateVarString(const std::string& string);
28 PP_Var CreateVarBinary(const std::vector<uint8_t>& binary);
29 void ReleaseVar(const PP_Var& var);
30 bool AreEqualWithString(const PP_Var& var, const std::string& string);
31 bool AreEqualWithBinary(const PP_Var& var,
32 const std::vector<uint8_t>& binary);
34 PP_Resource Connect(const std::string& url,
35 int32_t* result,
36 const std::string& protocol);
38 void Send(int32_t result, PP_Resource ws, const std::string& message);
40 std::string TestIsWebSocket();
41 std::string TestUninitializedPropertiesAccess();
42 std::string TestInvalidConnect();
43 std::string TestProtocols();
44 std::string TestGetURL();
45 std::string TestValidConnect();
46 std::string TestInvalidClose();
47 std::string TestValidClose();
48 std::string TestGetProtocol();
49 std::string TestTextSendReceive();
50 std::string TestTextSendReceiveTwice();
51 std::string TestBinarySendReceive();
52 std::string TestStressedSendReceive();
53 std::string TestBufferedAmount();
54 std::string TestAbortCallsWithCallback();
55 std::string TestAbortSendMessageCall();
56 std::string TestAbortCloseCall();
57 std::string TestAbortReceiveMessageCall();
58 std::string TestClosedFromServerWhileSending();
60 std::string TestCcInterfaces();
62 std::string TestUtilityInvalidConnect();
63 std::string TestUtilityProtocols();
64 std::string TestUtilityGetURL();
65 std::string TestUtilityValidConnect();
66 std::string TestUtilityInvalidClose();
67 std::string TestUtilityValidClose();
68 std::string TestUtilityGetProtocol();
69 std::string TestUtilityTextSendReceive();
70 std::string TestUtilityBinarySendReceive();
71 std::string TestUtilityBufferedAmount();
73 // Keeps Pepper API interfaces. These are used by the tests that access the C
74 // API directly.
75 const PPB_WebSocket* websocket_interface_;
76 const PPB_Var* var_interface_;
77 const PPB_VarArrayBuffer* arraybuffer_interface_;
78 const PPB_Core* core_interface_;
81 #endif // PPAPI_TESTS_TEST_WEBSOCKET_H_