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

Unified Diff: content/browser/message_port_provider_browsertest.cc

Issue 921013002: Optionally have MessagePort pass data as base::Value, part 1. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-move-v8-value-converter
Patch Set: Update singly-included comment Created 5 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
« no previous file with comments | « content/browser/message_port_provider.cc ('k') | content/browser/message_port_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/message_port_provider_browsertest.cc
diff --git a/content/browser/message_port_provider_browsertest.cc b/content/browser/message_port_provider_browsertest.cc
index 3c9ea5d4df5a780739e02be0382a2a9c0436d69e..b7f7a639cadcde30460d3599b22e051b5e409f1a 100644
--- a/content/browser/message_port_provider_browsertest.cc
+++ b/content/browser/message_port_provider_browsertest.cc
@@ -25,7 +25,7 @@ class MockMessagePortDelegate : public MessagePortDelegate {
// A container to hold received messages
struct Message {
int route_id; // the routing id of the target port
- base::string16 data; // the message data
+ MessagePortMessage data; // the message data
std::vector<int> sent_ports; // any transferred ports
};
@@ -36,7 +36,7 @@ class MockMessagePortDelegate : public MessagePortDelegate {
// MessagePortDelegate implementation
void SendMessage(int route_id,
- const base::string16& message,
+ const MessagePortMessage& message,
const std::vector<int>& sent_message_port_ids) override {
Message m;
m.route_id = route_id;
@@ -100,7 +100,8 @@ void VerifyCreateChannelOnIOThread(base::WaitableEvent* event) {
MessagePortService* service = MessagePortService::GetInstance();
// Send a message to port1 transferring no ports.
std::vector<int> sent_ports;
- service->PostMessage(port1, base::string16(MESSAGE1), sent_ports);
+ service->PostMessage(port1, MessagePortMessage(base::string16(MESSAGE1)),
+ sent_ports);
// Verify that message is received
const MockMessagePortDelegate::Messages& received =
delegate.getReceivedMessages();
@@ -108,7 +109,7 @@ void VerifyCreateChannelOnIOThread(base::WaitableEvent* event) {
// Verify that message sent to port1 is received by entangled port, which is
// port2.
EXPECT_EQ(received[0].route_id, port2);
- EXPECT_EQ(received[0].data, MESSAGE1);
+ EXPECT_EQ(received[0].data.message_as_string, MESSAGE1);
EXPECT_EQ(received[0].sent_ports.size(), 0u);
// Create a new channel, and transfer one of its ports to port2, making sure
@@ -117,10 +118,11 @@ void VerifyCreateChannelOnIOThread(base::WaitableEvent* event) {
int port4;
MessagePortProvider::CreateMessageChannel(&delegate, &port3, &port4);
sent_ports.push_back(port3);
- service->PostMessage(port1, base::string16(MESSAGE2), sent_ports);
+ service->PostMessage(port1, MessagePortMessage(base::string16(MESSAGE2)),
+ sent_ports);
EXPECT_EQ(received.size(), 2u);
EXPECT_EQ(received[1].route_id, port2);
- EXPECT_EQ(received[1].data, MESSAGE2);
+ EXPECT_EQ(received[1].data.message_as_string, MESSAGE2);
EXPECT_EQ(received[1].sent_ports.size(), 1u);
EXPECT_EQ(received[1].sent_ports[0], port3);
« no previous file with comments | « content/browser/message_port_provider.cc ('k') | content/browser/message_port_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698