Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 PAPPI_TESTS_TEST_WEBSOCKET_H_ | 5 #ifndef PAPPI_TESTS_TEST_WEBSOCKET_H_ |
| 6 #define PAPPI_TESTS_TEST_WEBSOCKET_H_ | 6 #define PAPPI_TESTS_TEST_WEBSOCKET_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ppapi/c/ppb_core.h" | 10 #include "ppapi/c/ppb_core.h" |
| 11 #include "ppapi/c/ppb_var.h" | 11 #include "ppapi/c/ppb_var.h" |
| 12 #include "ppapi/c/ppb_var_array_buffer.h" | 12 #include "ppapi/c/ppb_var_array_buffer.h" |
| 13 #include "ppapi/c/ppb_websocket.h" | 13 #include "ppapi/c/ppb_websocket.h" |
| 14 #include "ppapi/tests/test_case.h" | 14 #include "ppapi/tests/test_case.h" |
| 15 #include "ppapi/tests/test_utils.h" | |
| 15 | 16 |
| 16 class TestWebSocket : public TestCase { | 17 class TestWebSocket |
| 18 : public TestCase, | |
| 19 public TestCompletionCallback::Delegate { | |
|
dmichael (off chromium)
2012/06/25 15:50:51
I think it would be cleaner to define a separate c
Takashi Toyoshima
2012/06/26 09:19:10
OK, I will introduce class ReleaseResourceDelegate
| |
| 17 public: | 20 public: |
| 18 explicit TestWebSocket(TestingInstance* instance) : TestCase(instance) {} | 21 explicit TestWebSocket(TestingInstance* instance) : TestCase(instance) {} |
| 19 | 22 |
| 23 // TestCompletionCallback::Delegate interfaces. | |
|
dmichael (off chromium)
2012/06/25 15:50:51
interfaces->implementation
Takashi Toyoshima
2012/06/26 09:19:10
Done.
| |
| 24 virtual void OnCallback(void* user_data, int32_t result); | |
| 25 | |
| 20 private: | 26 private: |
| 21 // TestCase implementation. | 27 // TestCase implementation. |
| 22 virtual bool Init(); | 28 virtual bool Init(); |
| 23 virtual void RunTests(const std::string& filter); | 29 virtual void RunTests(const std::string& filter); |
| 24 | 30 |
| 25 std::string GetFullURL(const char* url); | 31 std::string GetFullURL(const char* url); |
| 26 PP_Var CreateVarString(const std::string& string); | 32 PP_Var CreateVarString(const std::string& string); |
| 27 PP_Var CreateVarBinary(const std::vector<uint8_t>& binary); | 33 PP_Var CreateVarBinary(const std::vector<uint8_t>& binary); |
| 28 void ReleaseVar(const PP_Var& var); | 34 void ReleaseVar(const PP_Var& var); |
| 29 bool AreEqualWithString(const PP_Var& var, const std::string& string); | 35 bool AreEqualWithString(const PP_Var& var, const std::string& string); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 std::string TestUtilityTextSendReceive(); | 67 std::string TestUtilityTextSendReceive(); |
| 62 std::string TestUtilityBinarySendReceive(); | 68 std::string TestUtilityBinarySendReceive(); |
| 63 std::string TestUtilityBufferedAmount(); | 69 std::string TestUtilityBufferedAmount(); |
| 64 | 70 |
| 65 // Keeps Pepper API interfaces. These are used by the tests that access the C | 71 // Keeps Pepper API interfaces. These are used by the tests that access the C |
| 66 // API directly. | 72 // API directly. |
| 67 const PPB_WebSocket* websocket_interface_; | 73 const PPB_WebSocket* websocket_interface_; |
| 68 const PPB_Var* var_interface_; | 74 const PPB_Var* var_interface_; |
| 69 const PPB_VarArrayBuffer* arraybuffer_interface_; | 75 const PPB_VarArrayBuffer* arraybuffer_interface_; |
| 70 const PPB_Core* core_interface_; | 76 const PPB_Core* core_interface_; |
| 77 | |
| 78 // This resource will be released in |OnCallback|. | |
| 79 PP_Resource resource_; | |
| 71 }; | 80 }; |
| 72 | 81 |
| 73 #endif // PAPPI_TESTS_TEST_WEBSOCKET_H_ | 82 #endif // PAPPI_TESTS_TEST_WEBSOCKET_H_ |
| OLD | NEW |