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

Unified Diff: mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc

Issue 1785843002: [mojo] Implement pipe fusion API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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 | « mojo/public/cpp/bindings/interface_request.h ('k') | mojo/public/cpp/system/message_pipe.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
index d63b542d82d8ee028e07068f9dd54f41da4de765..633d8f1645437436ee7aa0fdd93959a246baf31c 100644
--- a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
@@ -714,6 +714,42 @@ TEST_F(InterfacePtrTest, Scoping) {
EXPECT_TRUE(a_impl.d_called());
}
+class PingTestImpl : public sample::PingTest {
+ public:
+ explicit PingTestImpl(InterfaceRequest<sample::PingTest> request)
+ : binding_(this, std::move(request)) {}
+ ~PingTestImpl() override {}
+
+ private:
+ // sample::PingTest:
+ void Ping(const PingCallback& callback) override { callback.Run(); }
+
+ Binding<sample::PingTest> binding_;
+};
+
+// Tests that FuseProxy does what it's supposed to do.
+TEST_F(InterfacePtrTest, Fusion) {
+ sample::PingTestPtr proxy;
+ PingTestImpl impl(GetProxy(&proxy));
+
+ // Create another PingTest pipe.
+ sample::PingTestPtr ptr;
+ sample::PingTestRequest request = GetProxy(&ptr);
+
+ // Fuse the new pipe to the one hanging off |impl|.
+ EXPECT_TRUE(FuseInterface(std::move(request), proxy.PassInterface()));
+
+ // Ping!
+ bool called = false;
+ base::RunLoop loop;
+ ptr->Ping([&called, &loop] {
+ called = true;
+ loop.Quit();
+ });
+ loop.Run();
+ EXPECT_TRUE(called);
+}
+
} // namespace
} // namespace test
} // namespace mojo
« no previous file with comments | « mojo/public/cpp/bindings/interface_request.h ('k') | mojo/public/cpp/system/message_pipe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698