Index: ppapi/proxy/websocket_resource_unittest.cc |
diff --git a/ppapi/proxy/websocket_resource_unittest.cc b/ppapi/proxy/websocket_resource_unittest.cc |
index 56012b33f6781889e03e47575ca32b1daea70805..89ea831e7f7ed877d79f3ccbf7c672fbd0e6a4a7 100644 |
--- a/ppapi/proxy/websocket_resource_unittest.cc |
+++ b/ppapi/proxy/websocket_resource_unittest.cc |
@@ -7,10 +7,14 @@ |
#include "ppapi/c/pp_errors.h" |
#include "ppapi/c/ppb_websocket.h" |
#include "ppapi/c/ppb_var.h" |
+#include "ppapi/proxy/locking_resource_releaser.h" |
#include "ppapi/proxy/websocket_resource.h" |
#include "ppapi/proxy/ppapi_messages.h" |
#include "ppapi/proxy/ppapi_proxy_test.h" |
+#include "ppapi/shared_impl/ppapi_globals.h" |
#include "ppapi/shared_impl/ppb_var_shared.h" |
+#include "ppapi/shared_impl/proxy_lock.h" |
+#include "ppapi/shared_impl/resource_tracker.h" |
#include "ppapi/shared_impl/scoped_pp_resource.h" |
#include "ppapi/shared_impl/scoped_pp_var.h" |
#include "ppapi/shared_impl/tracked_callback.h" |
@@ -59,11 +63,10 @@ TEST_F(WebSocketResourceTest, Connect) { |
PP_Var url_var = MakeStringVar(url); |
PP_Var protocols[] = { MakeStringVar(protocol0), MakeStringVar(protocol1) }; |
- ScopedPPResource res(ScopedPPResource::PassRef(), |
- websocket_iface->Create(pp_instance())); |
+ LockingResourceReleaser res(websocket_iface->Create(pp_instance())); |
- int32_t result = |
- websocket_iface->Connect(res, url_var, protocols, 2, MakeCallback()); |
+ int32_t result = websocket_iface->Connect(res.get(), url_var, protocols, 2, |
+ MakeCallback()); |
ASSERT_EQ(PP_OK_COMPLETIONPENDING, result); |
// Should be sent a "Connect" message. |
@@ -94,18 +97,17 @@ TEST_F(WebSocketResourceTest, UnsolicitedReplies) { |
const PPB_WebSocket_1_0* websocket_iface = |
thunk::GetPPB_WebSocket_1_0_Thunk(); |
- ScopedPPResource res(ScopedPPResource::PassRef(), |
- websocket_iface->Create(pp_instance())); |
+ LockingResourceReleaser res(websocket_iface->Create(pp_instance())); |
// Check if BufferedAmountReply is handled. |
- ResourceMessageReplyParams reply_params(res, 0); |
+ ResourceMessageReplyParams reply_params(res.get(), 0); |
reply_params.set_result(PP_OK); |
ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived( |
PpapiPluginMsg_ResourceReply( |
reply_params, |
PpapiPluginMsg_WebSocket_BufferedAmountReply(19760227u)))); |
- uint64_t amount = websocket_iface->GetBufferedAmount(res); |
+ uint64_t amount = websocket_iface->GetBufferedAmount(res.get()); |
EXPECT_EQ(19760227u, amount); |
// Check if StateReply is handled. |
@@ -115,7 +117,7 @@ TEST_F(WebSocketResourceTest, UnsolicitedReplies) { |
PpapiPluginMsg_WebSocket_StateReply( |
static_cast<int32_t>(PP_WEBSOCKETREADYSTATE_CLOSING))))); |
- PP_WebSocketReadyState state = websocket_iface->GetReadyState(res); |
+ PP_WebSocketReadyState state = websocket_iface->GetReadyState(res.get()); |
EXPECT_EQ(PP_WEBSOCKETREADYSTATE_CLOSING, state); |
} |
@@ -126,12 +128,11 @@ TEST_F(WebSocketResourceTest, MessageError) { |
std::string url("ws://ws.google.com"); |
PP_Var url_var = MakeStringVar(url); |
- ScopedPPResource res(ScopedPPResource::PassRef(), |
- websocket_iface->Create(pp_instance())); |
+ LockingResourceReleaser res(websocket_iface->Create(pp_instance())); |
// Establish the connection virtually. |
int32_t result = |
- websocket_iface->Connect(res, url_var, NULL, 0, MakeCallback()); |
+ websocket_iface->Connect(res.get(), url_var, NULL, 0, MakeCallback()); |
ASSERT_EQ(PP_OK_COMPLETIONPENDING, result); |
ResourceMessageCallParams params; |
@@ -150,11 +151,11 @@ TEST_F(WebSocketResourceTest, MessageError) { |
EXPECT_TRUE(g_callback_called); |
PP_Var message; |
- result = websocket_iface->ReceiveMessage(res, &message, MakeCallback()); |
+ result = websocket_iface->ReceiveMessage(res.get(), &message, MakeCallback()); |
EXPECT_FALSE(g_callback_called); |
// Synthesize a WebSocket_ErrorReply message. |
- ResourceMessageReplyParams error_reply_params(res, 0); |
+ ResourceMessageReplyParams error_reply_params(res.get(), 0); |
error_reply_params.set_result(PP_OK); |
ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived( |
PpapiPluginMsg_ResourceReply(error_reply_params, |