Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2152)

Unified Diff: ppapi/proxy/websocket_resource_unittest.cc

Issue 46433002: Support using TrackedCallbacks as hints to determine the handling thread of resource reply messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/udp_socket_resource_base.cc ('k') | ppapi/shared_impl/ppb_message_loop_shared.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/websocket_resource_unittest.cc
diff --git a/ppapi/proxy/websocket_resource_unittest.cc b/ppapi/proxy/websocket_resource_unittest.cc
index ecd9111c980ad1f90a3d63ba2f7b52a4a79b8ea7..5cfc71a88e37c2fd753c057a9486a838dd42ecfc 100644
--- a/ppapi/proxy/websocket_resource_unittest.cc
+++ b/ppapi/proxy/websocket_resource_unittest.cc
@@ -8,6 +8,7 @@
#include "ppapi/c/ppb_var.h"
#include "ppapi/c/ppb_websocket.h"
#include "ppapi/proxy/locking_resource_releaser.h"
+#include "ppapi/proxy/plugin_message_filter.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppapi_proxy_test.h"
#include "ppapi/proxy/websocket_resource.h"
@@ -84,9 +85,8 @@ TEST_F(WebSocketResourceTest, Connect) {
ResourceMessageReplyParams reply_params(params.pp_resource(),
params.sequence());
reply_params.set_result(PP_OK);
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(reply_params,
- PpapiPluginMsg_WebSocket_ConnectReply(url, protocol1))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ reply_params, PpapiPluginMsg_WebSocket_ConnectReply(url, protocol1));
EXPECT_EQ(PP_OK, g_callback_result);
EXPECT_EQ(true, g_callback_called);
@@ -102,20 +102,17 @@ TEST_F(WebSocketResourceTest, UnsolicitedReplies) {
// Check if BufferedAmountReply is handled.
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))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ reply_params, PpapiPluginMsg_WebSocket_BufferedAmountReply(19760227u));
uint64_t amount = websocket_iface->GetBufferedAmount(res.get());
EXPECT_EQ(19760227u, amount);
// Check if StateReply is handled.
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(
- reply_params,
- PpapiPluginMsg_WebSocket_StateReply(
- static_cast<int32_t>(PP_WEBSOCKETREADYSTATE_CLOSING)))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ reply_params,
+ PpapiPluginMsg_WebSocket_StateReply(
+ static_cast<int32_t>(PP_WEBSOCKETREADYSTATE_CLOSING)));
PP_WebSocketReadyState state = websocket_iface->GetReadyState(res.get());
EXPECT_EQ(PP_WEBSOCKETREADYSTATE_CLOSING, state);
@@ -143,9 +140,9 @@ TEST_F(WebSocketResourceTest, MessageError) {
ResourceMessageReplyParams connect_reply_params(params.pp_resource(),
params.sequence());
connect_reply_params.set_result(PP_OK);
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(connect_reply_params,
- PpapiPluginMsg_WebSocket_ConnectReply(url, std::string()))));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ connect_reply_params,
+ PpapiPluginMsg_WebSocket_ConnectReply(url, std::string()));
EXPECT_EQ(PP_OK, g_callback_result);
EXPECT_TRUE(g_callback_called);
@@ -157,9 +154,8 @@ TEST_F(WebSocketResourceTest, MessageError) {
// Synthesize a WebSocket_ErrorReply message.
ResourceMessageReplyParams error_reply_params(res.get(), 0);
error_reply_params.set_result(PP_OK);
- ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
- PpapiPluginMsg_ResourceReply(error_reply_params,
- PpapiPluginMsg_WebSocket_ErrorReply())));
+ PluginMessageFilter::DispatchResourceReplyForTest(
+ error_reply_params, PpapiPluginMsg_WebSocket_ErrorReply());
EXPECT_EQ(PP_ERROR_FAILED, g_callback_result);
EXPECT_TRUE(g_callback_called);
« no previous file with comments | « ppapi/proxy/udp_socket_resource_base.cc ('k') | ppapi/shared_impl/ppb_message_loop_shared.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698