| Index: mojo/public/cpp/bindings/tests/binding_unittest.cc
|
| diff --git a/mojo/public/cpp/bindings/tests/binding_unittest.cc b/mojo/public/cpp/bindings/tests/binding_unittest.cc
|
| index 15b899de7828b705d73f9b0bee3cc9890dc370a6..e87575da603d974a91dcceaf28304c090f1237ce 100644
|
| --- a/mojo/public/cpp/bindings/tests/binding_unittest.cc
|
| +++ b/mojo/public/cpp/bindings/tests/binding_unittest.cc
|
| @@ -311,6 +311,29 @@ TEST_F(BindingTest, ErrorHandleNotRunWhilePaused) {
|
| EXPECT_TRUE(called);
|
| }
|
|
|
| +class SingleMethodImpl : public sample::SingleMethod {
|
| + public:
|
| + explicit SingleMethodImpl(const Closure& on_call) : on_call_(on_call) {}
|
| + ~SingleMethodImpl() override {}
|
| +
|
| + private:
|
| + // sample::SingleMethod:
|
| + void Call() override { on_call_.Run(); }
|
| +
|
| + const Closure on_call_;
|
| +};
|
| +
|
| +// Tests that sync dispatch works when enabled on a Binding.
|
| +TEST_F(BindingTest, SyncDispatch) {
|
| + bool called = false;
|
| + sample::SingleMethodPtr ptr;
|
| + SingleMethodImpl impl([&called] { called = true; });
|
| + Binding<sample::SingleMethod> binding(&impl, GetProxy(&ptr));
|
| + binding.SetAllowSyncDispatch(true);
|
| + ptr->Call();
|
| + EXPECT_TRUE(called);
|
| +}
|
| +
|
| // StrongBindingTest -----------------------------------------------------------
|
|
|
| using StrongBindingTest = BindingTestBase;
|
|
|