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 <stdint.h> | 5 #include <stdint.h> |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 HandleSignalsState hss; | 1033 HandleSignalsState hss; |
1034 | 1034 |
1035 scoped_refptr<ChannelEndpoint> ep0; | 1035 scoped_refptr<ChannelEndpoint> ep0; |
1036 scoped_refptr<MessagePipe> mp0(MessagePipe::CreateLocalProxy(&ep0)); | 1036 scoped_refptr<MessagePipe> mp0(MessagePipe::CreateLocalProxy(&ep0)); |
1037 scoped_refptr<ChannelEndpoint> ep1; | 1037 scoped_refptr<ChannelEndpoint> ep1; |
1038 scoped_refptr<MessagePipe> mp1(MessagePipe::CreateProxyLocal(&ep1)); | 1038 scoped_refptr<MessagePipe> mp1(MessagePipe::CreateProxyLocal(&ep1)); |
1039 BootstrapChannelEndpoints(ep0, ep1); | 1039 BootstrapChannelEndpoints(ep0, ep1); |
1040 | 1040 |
1041 base::FilePath unused; | 1041 base::FilePath unused; |
1042 base::ScopedFILE fp( | 1042 base::ScopedFILE fp( |
1043 CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused)); | 1043 base::CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused)); |
1044 EXPECT_EQ(sizeof(kHello), fwrite(kHello, 1, sizeof(kHello), fp.get())); | 1044 EXPECT_EQ(sizeof(kHello), fwrite(kHello, 1, sizeof(kHello), fp.get())); |
1045 // We'll try to pass this dispatcher, which will cause a |PlatformHandle| to | 1045 // We'll try to pass this dispatcher, which will cause a |PlatformHandle| to |
1046 // be passed. | 1046 // be passed. |
1047 scoped_refptr<PlatformHandleDispatcher> dispatcher( | 1047 scoped_refptr<PlatformHandleDispatcher> dispatcher( |
1048 new PlatformHandleDispatcher( | 1048 new PlatformHandleDispatcher( |
1049 mojo::test::PlatformHandleFromFILE(fp.Pass()))); | 1049 mojo::test::PlatformHandleFromFILE(fp.Pass()))); |
1050 | 1050 |
1051 // Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do | 1051 // Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do |
1052 // it later, it might already be readable.) | 1052 // it later, it might already be readable.) |
1053 waiter.Init(); | 1053 waiter.Init(); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1367 mp0->Close(0); | 1367 mp0->Close(0); |
1368 mp1->Close(1); | 1368 mp1->Close(1); |
1369 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close()); | 1369 EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close()); |
1370 // Note that |local_mp|'s port 0 belong to |dispatcher|, which was closed. | 1370 // Note that |local_mp|'s port 0 belong to |dispatcher|, which was closed. |
1371 local_mp->Close(1); | 1371 local_mp->Close(1); |
1372 } | 1372 } |
1373 | 1373 |
1374 } // namespace | 1374 } // namespace |
1375 } // namespace system | 1375 } // namespace system |
1376 } // namespace mojo | 1376 } // namespace mojo |
OLD | NEW |