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

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

Issue 2665053002: Add tests for detecting lost associated interfaces. (Closed)
Patch Set: Created 3 years, 11 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 | « ipc/ipc_test.mojom ('k') | mojo/public/interfaces/bindings/tests/test_associated_interfaces.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc b/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
index e0a10b2ddbf99d7c208e9d2f75155c1bb6b87f2f..12482d1727d3c9070a942409f76f3211d236982f 100644
--- a/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
@@ -1122,6 +1122,29 @@ TEST_F(AssociatedInterfaceTest, BindLaterThreadSafeAssociatedInterfacePtr) {
thread_safe_ptr = nullptr;
}
+class DiscardingAssociatedPingProviderProvider
+ : public AssociatedPingProviderProvider {
+ public:
+ void GetPingProvider(
+ AssociatedPingProviderAssociatedRequest request) override {}
+};
+
+TEST_F(AssociatedInterfaceTest, CloseWithoutBindingAssociatedRequest) {
+ DiscardingAssociatedPingProviderProvider ping_provider_provider;
+ mojo::Binding<AssociatedPingProviderProvider> binding(
+ &ping_provider_provider);
+ auto provider_provider = binding.CreateInterfacePtrAndBind();
+ AssociatedPingProviderAssociatedPtr provider;
+ provider_provider->GetPingProvider(
+ mojo::MakeRequest(&provider, provider_provider.associated_group()));
+ PingServiceAssociatedPtr ping;
+ provider->GetPing(
+ mojo::MakeRequest(&ping, provider.associated_group()));
+ base::RunLoop run_loop;
+ ping.set_connection_error_handler(run_loop.QuitClosure());
+ run_loop.Run();
+}
+
} // namespace
} // namespace test
} // namespace mojo
« no previous file with comments | « ipc/ipc_test.mojom ('k') | mojo/public/interfaces/bindings/tests/test_associated_interfaces.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698