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

Unified Diff: content/browser/message_port_provider_browsertest.cc

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Address feedback from yusuf 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/message_port_provider_browsertest.cc
diff --git a/content/browser/message_port_provider_browsertest.cc b/content/browser/message_port_provider_browsertest.cc
index 6e7f895194747b0f44052b6f2eaf42a52d20bc6b..4fc5caf2ee867159e6c67dff8f6f3c7d89b9ab13 100644
--- a/content/browser/message_port_provider_browsertest.cc
+++ b/content/browser/message_port_provider_browsertest.cc
@@ -6,9 +6,8 @@
#include "base/macros.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/waitable_event.h"
-#include "content/browser/message_port_service.h"
+#include "content/common/message_port.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/message_port_delegate.h"
#include "content/public/browser/message_port_provider.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h"
@@ -20,45 +19,6 @@ namespace content {
// This test verifies the functionality of the Message Port Provider API.
-// A mock class for testing message port provider.
-class MockMessagePortDelegate : public MessagePortDelegate {
- public:
- // A container to hold received messages
- struct Message {
- int route_id; // the routing id of the target port
- base::string16 data; // the message data
- std::vector<int> sent_ports; // any transferred ports
- };
-
- typedef std::vector<Message> Messages;
-
- MockMessagePortDelegate() { }
- ~MockMessagePortDelegate() override { }
-
- // MessagePortDelegate implementation
- void SendMessage(
- int route_id,
- const base::string16& message,
- const std::vector<int>& sent_message_ports) override {
- Message m;
- m.route_id = route_id;
- m.data = message;
- m.sent_ports = sent_message_ports;
- messages_.push_back(m);
- }
-
- void SendMessagesAreQueued(int route_id) override { }
-
- const Messages& getReceivedMessages() {
- return messages_;
- }
- private:
- Messages messages_;
-
- DISALLOW_COPY_AND_ASSIGN(MockMessagePortDelegate);
-};
-
-
class MessagePortProviderBrowserTest : public ContentBrowserTest {
};
@@ -77,13 +37,11 @@ IN_PROC_BROWSER_TEST_F(MessagePortProviderBrowserTest, PostMessage) {
content::LoadDataWithBaseURL(shell(), history_url, data, base_url);
const base::string16 source_origin(base::UTF8ToUTF16("source"));
const base::string16 message(base::UTF8ToUTF16("success"));
- const std::vector<int> ports;
content::TitleWatcher title_watcher(shell()->web_contents(), message);
MessagePortProvider::PostMessageToFrame(shell()->web_contents(),
source_origin,
target_origin,
- message,
- ports);
+ message);
EXPECT_EQ(message, title_watcher.WaitAndGetTitle());
}

Powered by Google App Engine
This is Rietveld 408576698