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

Unified Diff: content/browser/shared_worker/shared_worker_service_impl_unittest.cc

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Add missing ScopedAsyncTaskScheduler instance for the new unit tests; required by a recent change t… Created 3 years, 10 months 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: content/browser/shared_worker/shared_worker_service_impl_unittest.cc
diff --git a/content/browser/shared_worker/shared_worker_service_impl_unittest.cc b/content/browser/shared_worker/shared_worker_service_impl_unittest.cc
index fec5578f1563e04323c72b229efad7a74f3e2c1d..db5c128404b9e9d56479dd37830e975d5a7a503a 100644
--- a/content/browser/shared_worker/shared_worker_service_impl_unittest.cc
+++ b/content/browser/shared_worker/shared_worker_service_impl_unittest.cc
@@ -18,10 +18,9 @@
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/lock.h"
-#include "content/browser/message_port_message_filter.h"
+#include "base/synchronization/waitable_event.h"
#include "content/browser/shared_worker/shared_worker_message_filter.h"
#include "content/browser/shared_worker/worker_storage_partition.h"
-#include "content/common/message_port_messages.h"
#include "content/common/view_messages.h"
#include "content/common/worker_messages.h"
#include "content/public/browser/storage_partition.h"
@@ -112,30 +111,17 @@ static const int kProcessIDs[] = {100, 101, 102};
static const unsigned long long kDocumentIDs[] = {200, 201, 202};
static const int kRenderFrameRouteIDs[] = {300, 301, 302};
-class MockMessagePortMessageFilter : public MessagePortMessageFilter {
- public:
- MockMessagePortMessageFilter(
- const NextRoutingIDCallback& callback,
- std::vector<std::unique_ptr<IPC::Message>>* message_queue)
- : MessagePortMessageFilter(callback), message_queue_(message_queue) {}
-
- bool Send(IPC::Message* message) override {
- std::unique_ptr<IPC::Message> owned(message);
- if (!message_queue_)
- return false;
- message_queue_->push_back(std::move(owned));
- return true;
- }
-
- void Close() {
- message_queue_ = nullptr;
- OnChannelClosing();
- }
+void BlockingReadFromMessagePort(MessagePort port, base::string16* message) {
+ base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL,
+ base::WaitableEvent::InitialState::NOT_SIGNALED);
+ port.SetCallback(
+ base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event)));
+ event.Wait();
- private:
- ~MockMessagePortMessageFilter() override {}
- std::vector<std::unique_ptr<IPC::Message>>* message_queue_;
-};
+ std::vector<MessagePort> should_be_empty;
+ EXPECT_TRUE(port.GetMessage(message, &should_be_empty));
+ EXPECT_TRUE(should_be_empty.empty());
+}
class MockSharedWorkerMessageFilter : public SharedWorkerMessageFilter {
public:
@@ -143,12 +129,12 @@ class MockSharedWorkerMessageFilter : public SharedWorkerMessageFilter {
int render_process_id,
ResourceContext* resource_context,
const WorkerStoragePartition& partition,
- MessagePortMessageFilter* message_port_filter,
+ const SharedWorkerMessageFilter::NextRoutingIDCallback& callback,
std::vector<std::unique_ptr<IPC::Message>>* message_queue)
: SharedWorkerMessageFilter(render_process_id,
resource_context,
partition,
- message_port_filter),
+ callback),
message_queue_(message_queue) {}
bool Send(IPC::Message* message) override {
@@ -175,28 +161,24 @@ class MockRendererProcessHost {
ResourceContext* resource_context,
const WorkerStoragePartition& partition)
: process_id_(process_id),
- message_filter_(new MockMessagePortMessageFilter(
+ worker_filter_(new MockSharedWorkerMessageFilter(
+ process_id,
+ resource_context,
+ partition,
base::Bind(&base::AtomicSequenceNumber::GetNext,
base::Unretained(&next_routing_id_)),
- &queued_messages_)),
- worker_filter_(new MockSharedWorkerMessageFilter(process_id,
- resource_context,
- partition,
- message_filter_.get(),
- &queued_messages_)) {
+ &queued_messages_)) {
SharedWorkerServiceImplTest::RegisterRunningProcessID(process_id);
}
~MockRendererProcessHost() {
SharedWorkerServiceImplTest::UnregisterRunningProcessID(process_id_);
- message_filter_->Close();
worker_filter_->Close();
}
bool OnMessageReceived(IPC::Message* message) {
std::unique_ptr<IPC::Message> msg(message);
- const bool ret = message_filter_->OnMessageReceived(*message) ||
- worker_filter_->OnMessageReceived(*message);
+ const bool ret = worker_filter_->OnMessageReceived(*message);
if (message->is_sync()) {
CHECK(!queued_messages_.empty());
std::unique_ptr<IPC::Message> response_msg(
@@ -228,25 +210,9 @@ class MockRendererProcessHost {
const int process_id_;
std::vector<std::unique_ptr<IPC::Message>> queued_messages_;
base::AtomicSequenceNumber next_routing_id_;
- scoped_refptr<MockMessagePortMessageFilter> message_filter_;
scoped_refptr<MockSharedWorkerMessageFilter> worker_filter_;
};
-void CreateMessagePortPair(MockRendererProcessHost* renderer,
- int* route_1,
- int* port_1,
- int* route_2,
- int* port_2) {
- EXPECT_TRUE(renderer->OnMessageReceived(
- new MessagePortHostMsg_CreateMessagePort(route_1, port_1)));
- EXPECT_TRUE(renderer->OnMessageReceived(
- new MessagePortHostMsg_CreateMessagePort(route_2, port_2)));
- EXPECT_TRUE(renderer->OnMessageReceived(
- new MessagePortHostMsg_Entangle(*port_1, *port_2)));
- EXPECT_TRUE(renderer->OnMessageReceived(
- new MessagePortHostMsg_Entangle(*port_2, *port_1)));
-}
-
void PostCreateWorker(MockRendererProcessHost* renderer,
const std::string& url,
const std::string& name,
@@ -269,61 +235,31 @@ void PostCreateWorker(MockRendererProcessHost* renderer,
class MockSharedWorkerConnector {
public:
MockSharedWorkerConnector(MockRendererProcessHost* renderer_host)
- : renderer_host_(renderer_host),
- temporary_remote_port_route_id_(0),
- remote_port_id_(0),
- local_port_route_id_(0),
- local_port_id_(0) {}
+ : renderer_host_(renderer_host) {}
void Create(const std::string& url,
const std::string& name,
unsigned long long document_id,
int render_frame_route_id) {
- CreateMessagePortPair(renderer_host_,
- &temporary_remote_port_route_id_,
- &remote_port_id_,
- &local_port_route_id_,
- &local_port_id_);
PostCreateWorker(renderer_host_, url, name, document_id,
render_frame_route_id, &create_worker_reply_);
}
- void SendQueueMessages() {
- EXPECT_TRUE(renderer_host_->OnMessageReceived(
- new MessagePortHostMsg_QueueMessages(remote_port_id_)));
- }
- void SendPostMessage(const std::string& data) {
- const std::vector<int> empty_ports;
- EXPECT_TRUE(
- renderer_host_->OnMessageReceived(new MessagePortHostMsg_PostMessage(
- local_port_id_, base::ASCIIToUTF16(data), empty_ports)));
- }
void SendConnect() {
+ mojo::MessagePipe message_pipe;
+ local_port_ = MessagePort(std::move(message_pipe.handle0));
+
EXPECT_TRUE(
renderer_host_->OnMessageReceived(new ViewHostMsg_ConnectToWorker(
- create_worker_reply_.route_id, remote_port_id_)));
- }
- void SendSendQueuedMessages(
- const std::vector<QueuedMessage>& queued_messages) {
- EXPECT_TRUE(renderer_host_->OnMessageReceived(
- new MessagePortHostMsg_SendQueuedMessages(remote_port_id_,
- queued_messages)));
+ create_worker_reply_.route_id,
+ MessagePort(std::move(message_pipe.handle1)))));
}
- int temporary_remote_port_route_id() {
- return temporary_remote_port_route_id_;
- }
- int remote_port_id() { return remote_port_id_; }
- int local_port_route_id() { return local_port_route_id_; }
- int local_port_id() { return local_port_id_; }
+ MessagePort local_port() { return local_port_; }
int route_id() { return create_worker_reply_.route_id; }
blink::WebWorkerCreationError creation_error() {
return create_worker_reply_.error;
}
-
private:
MockRendererProcessHost* renderer_host_;
- int temporary_remote_port_route_id_;
- int remote_port_id_;
- int local_port_route_id_;
- int local_port_id_;
+ MessagePort local_port_;
ViewHostMsg_CreateWorker_Reply create_worker_reply_;
};
@@ -363,37 +299,17 @@ void CheckViewMsgCountFeature(MockRendererProcessHost* renderer_host,
EXPECT_EQ(expected_feature, feature);
}
-void CheckMessagePortMsgMessagesQueued(MockRendererProcessHost* renderer_host,
- MockSharedWorkerConnector* connector) {
- std::unique_ptr<IPC::Message> msg(renderer_host->PopMessage());
- EXPECT_EQ(MessagePortMsg_MessagesQueued::ID, msg->type());
- EXPECT_EQ(connector->temporary_remote_port_route_id(), msg->routing_id());
-}
-
void CheckWorkerMsgConnect(MockRendererProcessHost* renderer_host,
int expected_msg_route_id,
- int expected_sent_message_port_id,
- int* routing_id) {
+ int* connection_request_id,
+ MessagePort* port) {
std::unique_ptr<IPC::Message> msg(renderer_host->PopMessage());
EXPECT_EQ(WorkerMsg_Connect::ID, msg->type());
EXPECT_EQ(expected_msg_route_id, msg->routing_id());
WorkerMsg_Connect::Param params;
EXPECT_TRUE(WorkerMsg_Connect::Read(msg.get(), &params));
- int port_id = std::get<0>(params);
- *routing_id = std::get<1>(params);
- EXPECT_EQ(expected_sent_message_port_id, port_id);
-}
-
-void CheckMessagePortMsgMessage(MockRendererProcessHost* renderer_host,
- int expected_msg_route_id,
- std::string expected_data) {
- std::unique_ptr<IPC::Message> msg(renderer_host->PopMessage());
- EXPECT_EQ(MessagePortMsg_Message::ID, msg->type());
- EXPECT_EQ(expected_msg_route_id, msg->routing_id());
- MessagePortMsg_Message::Param params;
- EXPECT_TRUE(MessagePortMsg_Message::Read(msg.get(), &params));
- base::string16 data = std::get<0>(params);
- EXPECT_EQ(base::ASCIIToUTF16(expected_data), data);
+ *connection_request_id = std::get<0>(params);
+ *port = std::get<1>(params);
}
void CheckViewMsgWorkerConnected(MockRendererProcessHost* renderer_host,
@@ -418,15 +334,12 @@ TEST_F(SharedWorkerServiceImplTest, BasicTest) {
std::unique_ptr<MockSharedWorkerConnector> connector(
new MockSharedWorkerConnector(renderer_host.get()));
int worker_route_id;
- int worker_msg_port_route_id;
- // SharedWorkerConnector creates two message ports and sends
- // ViewHostMsg_CreateWorker.
+ // Sends ViewHostMsg_CreateWorker.
connector->Create("http://example.com/w.js",
"name",
kDocumentIDs[0],
kRenderFrameRouteIDs[0]);
- // We need to go to UI thread to call ReserveRenderProcessOnUI().
RunAllPendingInMessageLoop();
EXPECT_EQ(2U, renderer_host->QueuedMessageCount());
// WorkerProcessMsg_CreateWorker should be sent to the renderer in which
@@ -439,29 +352,15 @@ TEST_F(SharedWorkerServiceImplTest, BasicTest) {
// ViewMsg_WorkerCreated(1) should be sent back to SharedWorkerConnector side.
CheckViewMsgWorkerCreated(renderer_host.get(), connector.get());
- // SharedWorkerConnector side sends MessagePortHostMsg_QueueMessages in
- // WebSharedWorkerProxy::connect.
- connector->SendQueueMessages();
- EXPECT_EQ(1U, renderer_host->QueuedMessageCount());
- // MessagePortMsg_MessagesQueued(2) should be sent back to
- // SharedWorkerConnector side.
- CheckMessagePortMsgMessagesQueued(renderer_host.get(), connector.get());
-
// When SharedWorkerConnector receives ViewMsg_WorkerCreated(1), it sends
- // WorkerMsg_Connect wrapped in ViewHostMsg_ForwardToWorker.
+ // WorkerMsg_Connect via ViewHostMsg_ConnectToWorker.
connector->SendConnect();
EXPECT_EQ(1U, renderer_host->QueuedMessageCount());
// WorkerMsg_Connect should be sent to SharedWorker side.
- CheckWorkerMsgConnect(renderer_host.get(),
- worker_route_id,
- connector->remote_port_id(),
- &worker_msg_port_route_id);
-
- // When SharedWorkerConnector receives MessagePortMsg_MessagesQueued(2), it
- // sends MessagePortHostMsg_SendQueuedMessages.
- std::vector<QueuedMessage> empty_messages;
- connector->SendSendQueuedMessages(empty_messages);
- EXPECT_EQ(0U, renderer_host->QueuedMessageCount());
+ int worker_msg_connection_request_id;
+ MessagePort worker_msg_port;
+ CheckWorkerMsgConnect(renderer_host.get(), worker_route_id,
+ &worker_msg_connection_request_id, &worker_msg_port);
// SharedWorker sends WorkerHostMsg_WorkerReadyForInspection in
// EmbeddedSharedWorkerStub::WorkerReadyForInspection().
@@ -479,29 +378,19 @@ TEST_F(SharedWorkerServiceImplTest, BasicTest) {
// EmbeddedSharedWorkerStub::workerScriptLoaded().
EXPECT_TRUE(
renderer_host->OnMessageReceived(new WorkerHostMsg_WorkerConnected(
- connector->remote_port_id(), worker_route_id)));
+ worker_msg_connection_request_id, worker_route_id)));
EXPECT_EQ(1U, renderer_host->QueuedMessageCount());
// ViewMsg_WorkerConnected should be sent to SharedWorkerConnector side.
CheckViewMsgWorkerConnected(renderer_host.get(), connector.get(),
std::set<uint32_t>());
- // When SharedWorkerConnector side sends MessagePortHostMsg_PostMessage,
- // SharedWorker side shuold receive MessagePortMsg_Message.
- connector->SendPostMessage("test1");
- EXPECT_EQ(1U, renderer_host->QueuedMessageCount());
- CheckMessagePortMsgMessage(
- renderer_host.get(), worker_msg_port_route_id, "test1");
-
- // When SharedWorker side sends MessagePortHostMsg_PostMessage,
- // SharedWorkerConnector side shuold receive MessagePortMsg_Message.
- const std::vector<int> empty_ports;
- EXPECT_TRUE(
- renderer_host->OnMessageReceived(new MessagePortHostMsg_PostMessage(
- connector->remote_port_id(),
- base::ASCIIToUTF16("test2"), empty_ports)));
- EXPECT_EQ(1U, renderer_host->QueuedMessageCount());
- CheckMessagePortMsgMessage(
- renderer_host.get(), connector->local_port_route_id(), "test2");
+ // Verify that |worker_msg_port| corresponds to |connector->local_port()|.
+ base::string16 expected_message(base::ASCIIToUTF16("test1"));
+ connector->local_port().PostMessage(expected_message,
+ std::vector<MessagePort>());
+ base::string16 received_message;
+ BlockingReadFromMessagePort(worker_msg_port, &received_message);
+ EXPECT_EQ(expected_message, received_message);
// SharedWorker sends WorkerHostMsg_CountFeature in
// EmbeddedSharedWorkerStub::CountFeature().
@@ -538,15 +427,12 @@ TEST_F(SharedWorkerServiceImplTest, TwoRendererTest) {
std::unique_ptr<MockSharedWorkerConnector> connector0(
new MockSharedWorkerConnector(renderer_host0.get()));
int worker_route_id;
- int worker_msg_port_route_id1;
- // SharedWorkerConnector creates two message ports and sends
- // ViewHostMsg_CreateWorker.
+ // Sends ViewHostMsg_CreateWorker.
connector0->Create("http://example.com/w.js",
"name",
kDocumentIDs[0],
kRenderFrameRouteIDs[0]);
- // We need to go to UI thread to call ReserveRenderProcessOnUI().
RunAllPendingInMessageLoop();
EXPECT_EQ(2U, renderer_host0->QueuedMessageCount());
// WorkerProcessMsg_CreateWorker should be sent to the renderer in which
@@ -559,29 +445,15 @@ TEST_F(SharedWorkerServiceImplTest, TwoRendererTest) {
// ViewMsg_WorkerCreated(1) should be sent back to SharedWorkerConnector side.
CheckViewMsgWorkerCreated(renderer_host0.get(), connector0.get());
- // SharedWorkerConnector side sends MessagePortHostMsg_QueueMessages in
- // WebSharedWorkerProxy::connect.
- connector0->SendQueueMessages();
- EXPECT_EQ(1U, renderer_host0->QueuedMessageCount());
- // MessagePortMsg_MessagesQueued(2) should be sent back to
- // SharedWorkerConnector side.
- CheckMessagePortMsgMessagesQueued(renderer_host0.get(), connector0.get());
-
// When SharedWorkerConnector receives ViewMsg_WorkerCreated(1), it sends
// WorkerMsg_Connect wrapped in ViewHostMsg_ForwardToWorker.
connector0->SendConnect();
EXPECT_EQ(1U, renderer_host0->QueuedMessageCount());
// WorkerMsg_Connect should be sent to SharedWorker side.
- CheckWorkerMsgConnect(renderer_host0.get(),
- worker_route_id,
- connector0->remote_port_id(),
- &worker_msg_port_route_id1);
-
- // When SharedWorkerConnector receives MessagePortMsg_MessagesQueued(2), it
- // sends MessagePortHostMsg_SendQueuedMessages.
- std::vector<QueuedMessage> empty_messages;
- connector0->SendSendQueuedMessages(empty_messages);
- EXPECT_EQ(0U, renderer_host0->QueuedMessageCount());
+ int worker_msg_connection_request_id1;
+ MessagePort worker_msg_port1;
+ CheckWorkerMsgConnect(renderer_host0.get(), worker_route_id,
+ &worker_msg_connection_request_id1, &worker_msg_port1);
// SharedWorker sends WorkerHostMsg_WorkerReadyForInspection in
// EmbeddedSharedWorkerStub::WorkerReadyForInspection().
@@ -599,29 +471,19 @@ TEST_F(SharedWorkerServiceImplTest, TwoRendererTest) {
// EmbeddedSharedWorkerStub::workerScriptLoaded().
EXPECT_TRUE(
renderer_host0->OnMessageReceived(new WorkerHostMsg_WorkerConnected(
- connector0->remote_port_id(), worker_route_id)));
+ worker_msg_connection_request_id1, worker_route_id)));
EXPECT_EQ(1U, renderer_host0->QueuedMessageCount());
// ViewMsg_WorkerConnected should be sent to SharedWorkerConnector side.
CheckViewMsgWorkerConnected(renderer_host0.get(), connector0.get(),
std::set<uint32_t>());
- // When SharedWorkerConnector side sends MessagePortHostMsg_PostMessage,
- // SharedWorker side shuold receive MessagePortMsg_Message.
- connector0->SendPostMessage("test1");
- EXPECT_EQ(1U, renderer_host0->QueuedMessageCount());
- CheckMessagePortMsgMessage(
- renderer_host0.get(), worker_msg_port_route_id1, "test1");
-
- // When SharedWorker side sends MessagePortHostMsg_PostMessage,
- // SharedWorkerConnector side shuold receive MessagePortMsg_Message.
- const std::vector<int> empty_ports;
- EXPECT_TRUE(
- renderer_host0->OnMessageReceived(new MessagePortHostMsg_PostMessage(
- connector0->remote_port_id(),
- base::ASCIIToUTF16("test2"), empty_ports)));
- EXPECT_EQ(1U, renderer_host0->QueuedMessageCount());
- CheckMessagePortMsgMessage(
- renderer_host0.get(), connector0->local_port_route_id(), "test2");
+ // Verify that |worker_msg_port1| corresponds to |connector0->local_port()|.
+ base::string16 expected_message1(base::ASCIIToUTF16("test1"));
+ connector0->local_port().PostMessage(expected_message1,
+ std::vector<MessagePort>());
+ base::string16 received_message1;
+ BlockingReadFromMessagePort(worker_msg_port1, &received_message1);
+ EXPECT_EQ(expected_message1, received_message1);
// SharedWorker sends WorkerHostMsg_CountFeature in
// EmbeddedSharedWorkerStub::CountFeature().
@@ -645,7 +507,6 @@ TEST_F(SharedWorkerServiceImplTest, TwoRendererTest) {
*partition_.get()));
std::unique_ptr<MockSharedWorkerConnector> connector1(
new MockSharedWorkerConnector(renderer_host1.get()));
- int worker_msg_port_route_id2;
// UpdateWorkerDependency should not be called yet.
EXPECT_EQ(0, s_update_worker_dependency_call_count_);
@@ -668,55 +529,33 @@ TEST_F(SharedWorkerServiceImplTest, TwoRendererTest) {
EXPECT_EQ(kProcessIDs[0], s_worker_dependency_added_ids_[0]);
EXPECT_EQ(0U, s_worker_dependency_removed_ids_.size());
- // SharedWorkerConnector side sends MessagePortHostMsg_QueueMessages in
- // WebSharedWorkerProxy::connect.
- connector1->SendQueueMessages();
- EXPECT_EQ(1U, renderer_host1->QueuedMessageCount());
- // MessagePortMsg_MessagesQueued(4) should be sent back to
- // SharedWorkerConnector side.
- CheckMessagePortMsgMessagesQueued(renderer_host1.get(), connector1.get());
-
// When SharedWorkerConnector receives ViewMsg_WorkerCreated(3), it sends
// WorkerMsg_Connect wrapped in ViewHostMsg_ForwardToWorker.
connector1->SendConnect();
EXPECT_EQ(1U, renderer_host0->QueuedMessageCount());
// WorkerMsg_Connect should be sent to SharedWorker side.
- CheckWorkerMsgConnect(renderer_host0.get(),
- worker_route_id,
- connector1->remote_port_id(),
- &worker_msg_port_route_id2);
-
- // When SharedWorkerConnector receives MessagePortMsg_MessagesQueued(4), it
- // sends MessagePortHostMsg_SendQueuedMessages.
- connector1->SendSendQueuedMessages(empty_messages);
- EXPECT_EQ(0U, renderer_host1->QueuedMessageCount());
+ int worker_msg_connection_request_id2;
+ MessagePort worker_msg_port2;
+ CheckWorkerMsgConnect(renderer_host0.get(), worker_route_id,
+ &worker_msg_connection_request_id2, &worker_msg_port2);
// SharedWorker sends WorkerHostMsg_WorkerConnected in
// EmbeddedSharedWorkerStub::OnConnect().
EXPECT_TRUE(
renderer_host0->OnMessageReceived(new WorkerHostMsg_WorkerConnected(
- connector1->remote_port_id(), worker_route_id)));
+ worker_msg_connection_request_id2, worker_route_id)));
EXPECT_EQ(1U, renderer_host1->QueuedMessageCount());
// ViewMsg_WorkerConnected should be sent to SharedWorkerConnector side.
CheckViewMsgWorkerConnected(renderer_host1.get(), connector1.get(),
{feature1, feature2});
- // When SharedWorkerConnector side sends MessagePortHostMsg_PostMessage,
- // SharedWorker side shuold receive MessagePortMsg_Message.
- connector1->SendPostMessage("test3");
- EXPECT_EQ(1U, renderer_host0->QueuedMessageCount());
- CheckMessagePortMsgMessage(
- renderer_host0.get(), worker_msg_port_route_id2, "test3");
-
- // When SharedWorker side sends MessagePortHostMsg_PostMessage,
- // SharedWorkerConnector side shuold receive MessagePortMsg_Message.
- EXPECT_TRUE(
- renderer_host0->OnMessageReceived(new MessagePortHostMsg_PostMessage(
- connector1->remote_port_id(),
- base::ASCIIToUTF16("test4"), empty_ports)));
- EXPECT_EQ(1U, renderer_host1->QueuedMessageCount());
- CheckMessagePortMsgMessage(
- renderer_host1.get(), connector1->local_port_route_id(), "test4");
+ // Verify that |worker_msg_port2| corresponds to |connector1->local_port()|.
+ base::string16 expected_message2(base::ASCIIToUTF16("test2"));
+ connector1->local_port().PostMessage(expected_message2,
+ std::vector<MessagePort>());
+ base::string16 received_message2;
+ BlockingReadFromMessagePort(worker_msg_port2, &received_message2);
+ EXPECT_EQ(expected_message2, received_message2);
// SharedWorker sends WorkerHostMsg_CountFeature in
// EmbeddedSharedWorkerStub::CountFeature(). These used_features are already
« no previous file with comments | « content/browser/shared_worker/shared_worker_service_impl.cc ('k') | content/browser/web_contents/web_contents_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698