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

Side by Side 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, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 run_loop.Run(); 1115 run_loop.Run();
1116 } 1116 }
1117 1117
1118 other_thread_task_runner->DeleteSoon(FROM_HERE, context); 1118 other_thread_task_runner->DeleteSoon(FROM_HERE, context);
1119 1119
1120 // Reset the pointer now so the InterfacePtr associated resources can be 1120 // Reset the pointer now so the InterfacePtr associated resources can be
1121 // deleted before the background thread's message loop is invalidated. 1121 // deleted before the background thread's message loop is invalidated.
1122 thread_safe_ptr = nullptr; 1122 thread_safe_ptr = nullptr;
1123 } 1123 }
1124 1124
1125 class DiscardingAssociatedPingProviderProvider
1126 : public AssociatedPingProviderProvider {
1127 public:
1128 void GetPingProvider(
1129 AssociatedPingProviderAssociatedRequest request) override {}
1130 };
1131
1132 TEST_F(AssociatedInterfaceTest, CloseWithoutBindingAssociatedRequest) {
1133 DiscardingAssociatedPingProviderProvider ping_provider_provider;
1134 mojo::Binding<AssociatedPingProviderProvider> binding(
1135 &ping_provider_provider);
1136 auto provider_provider = binding.CreateInterfacePtrAndBind();
1137 AssociatedPingProviderAssociatedPtr provider;
1138 provider_provider->GetPingProvider(
1139 mojo::MakeRequest(&provider, provider_provider.associated_group()));
1140 PingServiceAssociatedPtr ping;
1141 provider->GetPing(
1142 mojo::MakeRequest(&ping, provider.associated_group()));
1143 base::RunLoop run_loop;
1144 ping.set_connection_error_handler(run_loop.QuitClosure());
1145 run_loop.Run();
1146 }
1147
1125 } // namespace 1148 } // namespace
1126 } // namespace test 1149 } // namespace test
1127 } // namespace mojo 1150 } // namespace mojo
OLDNEW
« 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