OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ipc/ipc_channel_mojo.h" | 5 #include "ipc/ipc_channel_mojo.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 RunProxy(); | 913 RunProxy(); |
914 | 914 |
915 // Use an interface requested via another interface. On the remote end both | 915 // Use an interface requested via another interface. On the remote end both |
916 // interfaces are bound on the proxy thread. This ensures that the Ping | 916 // interfaces are bound on the proxy thread. This ensures that the Ping |
917 // message we send will still be dispatched properly even though the remote | 917 // message we send will still be dispatched properly even though the remote |
918 // endpoint may not have been bound yet by the time the message is initially | 918 // endpoint may not have been bound yet by the time the message is initially |
919 // processed on the IO thread. | 919 // processed on the IO thread. |
920 IPC::mojom::IndirectTestDriverAssociatedPtr driver; | 920 IPC::mojom::IndirectTestDriverAssociatedPtr driver; |
921 IPC::mojom::PingReceiverAssociatedPtr ping_receiver; | 921 IPC::mojom::PingReceiverAssociatedPtr ping_receiver; |
922 proxy()->GetRemoteAssociatedInterface(&driver); | 922 proxy()->GetRemoteAssociatedInterface(&driver); |
923 driver->GetPingReceiver( | 923 driver->GetPingReceiver(mojo::MakeRequest(&ping_receiver)); |
924 mojo::MakeRequest(&ping_receiver, driver.associated_group())); | |
925 | 924 |
926 base::RunLoop loop; | 925 base::RunLoop loop; |
927 ping_receiver->Ping(loop.QuitClosure()); | 926 ping_receiver->Ping(loop.QuitClosure()); |
928 loop.Run(); | 927 loop.Run(); |
929 | 928 |
930 DestroyProxy(); | 929 DestroyProxy(); |
931 } | 930 } |
932 | 931 |
933 class ListenerWithSyncAssociatedInterface | 932 class ListenerWithSyncAssociatedInterface |
934 : public IPC::Listener, | 933 : public IPC::Listener, |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 TEST_F(IPCChannelProxyMojoTest, AssociatedRequestClose) { | 1267 TEST_F(IPCChannelProxyMojoTest, AssociatedRequestClose) { |
1269 Init("DropAssociatedRequest"); | 1268 Init("DropAssociatedRequest"); |
1270 | 1269 |
1271 DummyListener listener; | 1270 DummyListener listener; |
1272 CreateProxy(&listener); | 1271 CreateProxy(&listener); |
1273 RunProxy(); | 1272 RunProxy(); |
1274 | 1273 |
1275 IPC::mojom::AssociatedInterfaceVendorAssociatedPtr vendor; | 1274 IPC::mojom::AssociatedInterfaceVendorAssociatedPtr vendor; |
1276 proxy()->GetRemoteAssociatedInterface(&vendor); | 1275 proxy()->GetRemoteAssociatedInterface(&vendor); |
1277 IPC::mojom::SimpleTestDriverAssociatedPtr tester; | 1276 IPC::mojom::SimpleTestDriverAssociatedPtr tester; |
1278 vendor->GetTestInterface( | 1277 vendor->GetTestInterface(mojo::MakeRequest(&tester)); |
1279 mojo::MakeRequest(&tester, vendor.associated_group())); | |
1280 base::RunLoop run_loop; | 1278 base::RunLoop run_loop; |
1281 tester.set_connection_error_handler(run_loop.QuitClosure()); | 1279 tester.set_connection_error_handler(run_loop.QuitClosure()); |
1282 run_loop.Run(); | 1280 run_loop.Run(); |
1283 | 1281 |
1284 proxy()->GetRemoteAssociatedInterface(&tester); | 1282 proxy()->GetRemoteAssociatedInterface(&tester); |
1285 EXPECT_TRUE(WaitForClientShutdown()); | 1283 EXPECT_TRUE(WaitForClientShutdown()); |
1286 DestroyProxy(); | 1284 DestroyProxy(); |
1287 } | 1285 } |
1288 | 1286 |
1289 class AssociatedInterfaceDroppingListener : public IPC::Listener { | 1287 class AssociatedInterfaceDroppingListener : public IPC::Listener { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 Connect(&listener); | 1464 Connect(&listener); |
1467 | 1465 |
1468 base::RunLoop().Run(); | 1466 base::RunLoop().Run(); |
1469 | 1467 |
1470 Close(); | 1468 Close(); |
1471 } | 1469 } |
1472 | 1470 |
1473 #endif // OS_LINUX | 1471 #endif // OS_LINUX |
1474 | 1472 |
1475 } // namespace | 1473 } // namespace |
OLD | NEW |