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 #include "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
8 #include "ppapi/c/ppb_var.h" | 8 #include "ppapi/c/ppb_var.h" |
9 #include "ppapi/c/ppb_websocket.h" | 9 #include "ppapi/c/ppb_websocket.h" |
10 #include "ppapi/proxy/locking_resource_releaser.h" | 10 #include "ppapi/proxy/locking_resource_releaser.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 PP_CompletionCallback MakeCallback() { | 41 PP_CompletionCallback MakeCallback() { |
42 g_callback_called = false; | 42 g_callback_called = false; |
43 g_callback_result = PP_OK; | 43 g_callback_result = PP_OK; |
44 return PP_MakeCompletionCallback(Callback, NULL); | 44 return PP_MakeCompletionCallback(Callback, NULL); |
45 } | 45 } |
46 | 46 |
47 PP_Var MakeStringVar(const std::string& string) { | 47 PP_Var MakeStringVar(const std::string& string) { |
48 if (!ppb_var_) | 48 if (!ppb_var_) |
49 ppb_var_ = ppapi::PPB_Var_Shared::GetVarInterface1_2(); | 49 ppb_var_ = ppapi::PPB_Var_Shared::GetVarInterface1_2(); |
50 return ppb_var_->VarFromUtf8(string.c_str(), string.length()); | 50 return ppb_var_->VarFromUtf8(string.c_str(), |
| 51 static_cast<uint32_t>(string.length())); |
51 } | 52 } |
52 | 53 |
53 } // namespace | 54 } // namespace |
54 | 55 |
55 | 56 |
56 // Does a test of Connect(). | 57 // Does a test of Connect(). |
57 TEST_F(WebSocketResourceTest, Connect) { | 58 TEST_F(WebSocketResourceTest, Connect) { |
58 const PPB_WebSocket_1_0* websocket_iface = | 59 const PPB_WebSocket_1_0* websocket_iface = |
59 thunk::GetPPB_WebSocket_1_0_Thunk(); | 60 thunk::GetPPB_WebSocket_1_0_Thunk(); |
60 | 61 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 error_reply_params.set_result(PP_OK); | 157 error_reply_params.set_result(PP_OK); |
157 PluginMessageFilter::DispatchResourceReplyForTest( | 158 PluginMessageFilter::DispatchResourceReplyForTest( |
158 error_reply_params, PpapiPluginMsg_WebSocket_ErrorReply()); | 159 error_reply_params, PpapiPluginMsg_WebSocket_ErrorReply()); |
159 | 160 |
160 EXPECT_EQ(PP_ERROR_FAILED, g_callback_result); | 161 EXPECT_EQ(PP_ERROR_FAILED, g_callback_result); |
161 EXPECT_TRUE(g_callback_called); | 162 EXPECT_TRUE(g_callback_called); |
162 } | 163 } |
163 | 164 |
164 } // namespace proxy | 165 } // namespace proxy |
165 } // namespace ppapi | 166 } // namespace ppapi |
OLD | NEW |