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

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

Issue 1811433002: [mojo-edk] Expose notification source to MojoWatch callbacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename 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/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..054b36a9dbe8472e5d79daca438bd538dccacaf7 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.EnableImmediateDispatchOfEventsFromSameThread(true);
+ ptr->Call();
+ EXPECT_TRUE(called);
+}
+
// StrongBindingTest -----------------------------------------------------------
using StrongBindingTest = BindingTestBase;

Powered by Google App Engine
This is Rietveld 408576698