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

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

Issue 1823683006: Mojo C++ bindings: sync call support for associated interfaces and master interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: mojo/public/cpp/bindings/tests/sync_method_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/sync_method_unittest.cc b/mojo/public/cpp/bindings/tests/sync_method_unittest.cc
index 7a18f7d692d9be361d9f1fb54677b02fd39c6490..36c8b2be8b458684d0135d74b01b64d778bd7793 100644
--- a/mojo/public/cpp/bindings/tests/sync_method_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/sync_method_unittest.cc
@@ -85,6 +85,29 @@ class TestSyncImpl : public TestSync, public TestSyncCommonImpl {
DISALLOW_COPY_AND_ASSIGN(TestSyncImpl);
};
+class TestSyncMasterImpl : public TestSyncMaster, public TestSyncCommonImpl {
+ public:
+ explicit TestSyncMasterImpl(TestSyncMasterRequest request)
+ : binding_(this, std::move(request)) {}
+
+ // TestSyncMaster implementation:
+ void Ping(const PingCallback& callback) override { PingImpl(callback); }
+ void Echo(int32_t value, const EchoCallback& callback) override {
+ EchoImpl(value, callback);
+ }
+ void AsyncEcho(int32_t value, const AsyncEchoCallback& callback) override {
+ AsyncEchoImpl(value, callback);
+ }
+ void SendInterface(TestSyncAssociatedPtrInfo ptr) override {}
+
+ Binding<TestSyncMaster>* binding() { return &binding_; }
+
+ private:
+ Binding<TestSyncMaster> binding_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestSyncMasterImpl);
+};
+
template <typename Interface>
struct ImplTraits;
@@ -93,6 +116,11 @@ struct ImplTraits<TestSync> {
using Type = TestSyncImpl;
};
+template <>
+struct ImplTraits<TestSyncMaster> {
+ using Type = TestSyncMasterImpl;
+};
+
template <typename Interface>
class TestSyncServiceThread {
public:
@@ -148,7 +176,9 @@ class SyncMethodCommonTest : public testing::Test {
base::MessageLoop loop_;
};
-using InterfaceTypes = testing::Types<TestSync>;
+// TestSync and TestSyncMaster exercise Router and MultiplexRouter,
+// respectively.
+using InterfaceTypes = testing::Types<TestSync, TestSyncMaster>;
TYPED_TEST_CASE(SyncMethodCommonTest, InterfaceTypes);
TYPED_TEST(SyncMethodCommonTest, CallSyncMethodAsynchronously) {

Powered by Google App Engine
This is Rietveld 408576698