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

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: fix tests 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
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..252bfb3004d88ce6c113b22a33ba4aa323e337df 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,9 @@ 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 +103,18 @@ 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 +142,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 +156,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);

Powered by Google App Engine
This is Rietveld 408576698