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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/files/scoped_file.h" | 14 #include "base/files/scoped_file.h" |
15 #include "base/files/scoped_temp_dir.h" | 15 #include "base/files/scoped_temp_dir.h" |
16 #include "base/location.h" | 16 #include "base/location.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
20 #include "base/threading/platform_thread.h" // For |Sleep()|. | 20 #include "base/threading/platform_thread.h" // For |Sleep()|. |
21 #include "build/build_config.h" // TODO(vtl): Remove this. | 21 #include "build/build_config.h" // TODO(vtl): Remove this. |
22 #include "mojo/common/test/test_utils.h" | 22 #include "mojo/common/test/test_utils.h" |
23 #include "mojo/embedder/platform_channel_pair.h" | 23 #include "mojo/embedder/platform_channel_pair.h" |
24 #include "mojo/embedder/platform_shared_buffer.h" | 24 #include "mojo/embedder/platform_shared_buffer.h" |
25 #include "mojo/embedder/scoped_platform_handle.h" | 25 #include "mojo/embedder/scoped_platform_handle.h" |
26 #include "mojo/embedder/simple_platform_support.h" | 26 #include "mojo/embedder/simple_platform_support.h" |
27 #include "mojo/system/channel.h" | 27 #include "mojo/system/channel.h" |
28 #include "mojo/system/local_message_pipe_endpoint.h" | |
29 #include "mojo/system/message_pipe.h" | 28 #include "mojo/system/message_pipe.h" |
30 #include "mojo/system/message_pipe_dispatcher.h" | 29 #include "mojo/system/message_pipe_dispatcher.h" |
31 #include "mojo/system/platform_handle_dispatcher.h" | 30 #include "mojo/system/platform_handle_dispatcher.h" |
32 #include "mojo/system/proxy_message_pipe_endpoint.h" | |
33 #include "mojo/system/raw_channel.h" | 31 #include "mojo/system/raw_channel.h" |
34 #include "mojo/system/shared_buffer_dispatcher.h" | 32 #include "mojo/system/shared_buffer_dispatcher.h" |
35 #include "mojo/system/test_utils.h" | 33 #include "mojo/system/test_utils.h" |
36 #include "mojo/system/waiter.h" | 34 #include "mojo/system/waiter.h" |
37 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
38 | 36 |
39 namespace mojo { | 37 namespace mojo { |
40 namespace system { | 38 namespace system { |
41 namespace { | 39 namespace { |
42 | 40 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 char buffer[100] = {0}; | 184 char buffer[100] = {0}; |
187 uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); | 185 uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); |
188 Waiter waiter; | 186 Waiter waiter; |
189 HandleSignalsState hss; | 187 HandleSignalsState hss; |
190 uint32_t context = 0; | 188 uint32_t context = 0; |
191 | 189 |
192 // Connect message pipes. MP 0, port 1 will be attached to channel 0 and | 190 // Connect message pipes. MP 0, port 1 will be attached to channel 0 and |
193 // connected to MP 1, port 0, which will be attached to channel 1. This leaves | 191 // connected to MP 1, port 0, which will be attached to channel 1. This leaves |
194 // MP 0, port 0 and MP 1, port 1 as the "user-facing" endpoints. | 192 // MP 0, port 0 and MP 1, port 1 as the "user-facing" endpoints. |
195 | 193 |
196 scoped_refptr<MessagePipe> mp0(new MessagePipe( | 194 scoped_refptr<MessagePipe> mp0(MessagePipe::CreateLocalProxy()); |
197 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()), | 195 scoped_refptr<MessagePipe> mp1(MessagePipe::CreateProxyLocal()); |
198 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()))); | |
199 scoped_refptr<MessagePipe> mp1(new MessagePipe( | |
200 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()), | |
201 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()))); | |
202 ConnectMessagePipes(mp0, mp1); | 196 ConnectMessagePipes(mp0, mp1); |
203 | 197 |
204 // Write in one direction: MP 0, port 0 -> ... -> MP 1, port 1. | 198 // Write in one direction: MP 0, port 0 -> ... -> MP 1, port 1. |
205 | 199 |
206 // Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do | 200 // Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do |
207 // it later, it might already be readable.) | 201 // it later, it might already be readable.) |
208 waiter.Init(); | 202 waiter.Init(); |
209 ASSERT_EQ(MOJO_RESULT_OK, | 203 ASSERT_EQ(MOJO_RESULT_OK, |
210 mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, NULL)); | 204 mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, NULL)); |
211 | 205 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 static const char kHello[] = "hello"; | 293 static const char kHello[] = "hello"; |
300 static const char kWorld[] = "world!!!1!!!1!"; | 294 static const char kWorld[] = "world!!!1!!!1!"; |
301 char buffer[100] = {0}; | 295 char buffer[100] = {0}; |
302 uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); | 296 uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); |
303 Waiter waiter; | 297 Waiter waiter; |
304 HandleSignalsState hss; | 298 HandleSignalsState hss; |
305 uint32_t context = 0; | 299 uint32_t context = 0; |
306 | 300 |
307 // Connect message pipes as in the |Basic| test. | 301 // Connect message pipes as in the |Basic| test. |
308 | 302 |
309 scoped_refptr<MessagePipe> mp0(new MessagePipe( | 303 scoped_refptr<MessagePipe> mp0(MessagePipe::CreateLocalProxy()); |
310 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()), | 304 scoped_refptr<MessagePipe> mp1(MessagePipe::CreateProxyLocal()); |
311 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()))); | |
312 scoped_refptr<MessagePipe> mp1(new MessagePipe( | |
313 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()), | |
314 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()))); | |
315 ConnectMessagePipes(mp0, mp1); | 305 ConnectMessagePipes(mp0, mp1); |
316 | 306 |
317 // Now put another message pipe on the channel. | 307 // Now put another message pipe on the channel. |
318 | 308 |
319 scoped_refptr<MessagePipe> mp2(new MessagePipe( | 309 scoped_refptr<MessagePipe> mp2(MessagePipe::CreateLocalProxy()); |
320 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()), | 310 scoped_refptr<MessagePipe> mp3(MessagePipe::CreateProxyLocal()); |
321 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()))); | |
322 scoped_refptr<MessagePipe> mp3(new MessagePipe( | |
323 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()), | |
324 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()))); | |
325 ConnectMessagePipes(mp2, mp3); | 311 ConnectMessagePipes(mp2, mp3); |
326 | 312 |
327 // Write: MP 2, port 0 -> MP 3, port 1. | 313 // Write: MP 2, port 0 -> MP 3, port 1. |
328 | 314 |
329 waiter.Init(); | 315 waiter.Init(); |
330 ASSERT_EQ(MOJO_RESULT_OK, | 316 ASSERT_EQ(MOJO_RESULT_OK, |
331 mp3->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 789, NULL)); | 317 mp3->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 789, NULL)); |
332 | 318 |
333 EXPECT_EQ(MOJO_RESULT_OK, | 319 EXPECT_EQ(MOJO_RESULT_OK, |
334 mp2->WriteMessage(0, | 320 mp2->WriteMessage(0, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 char buffer[100] = {0}; | 440 char buffer[100] = {0}; |
455 uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); | 441 uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer)); |
456 Waiter waiter; | 442 Waiter waiter; |
457 HandleSignalsState hss; | 443 HandleSignalsState hss; |
458 uint32_t context = 0; | 444 uint32_t context = 0; |
459 | 445 |
460 // Connect message pipes. MP 0, port 1 will be attached to channel 0 and | 446 // Connect message pipes. MP 0, port 1 will be attached to channel 0 and |
461 // connected to MP 1, port 0, which will be attached to channel 1. This leaves | 447 // connected to MP 1, port 0, which will be attached to channel 1. This leaves |
462 // MP 0, port 0 and MP 1, port 1 as the "user-facing" endpoints. | 448 // MP 0, port 0 and MP 1, port 1 as the "user-facing" endpoints. |
463 | 449 |
464 scoped_refptr<MessagePipe> mp0(new MessagePipe( | 450 scoped_refptr<MessagePipe> mp0(MessagePipe::CreateLocalProxy()); |
465 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()), | |
466 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()))); | |
467 | 451 |
468 // Write to MP 0, port 0. | 452 // Write to MP 0, port 0. |
469 EXPECT_EQ(MOJO_RESULT_OK, | 453 EXPECT_EQ(MOJO_RESULT_OK, |
470 mp0->WriteMessage(0, | 454 mp0->WriteMessage(0, |
471 UserPointer<const void>(kHello), | 455 UserPointer<const void>(kHello), |
472 sizeof(kHello), | 456 sizeof(kHello), |
473 NULL, | 457 NULL, |
474 MOJO_WRITE_MESSAGE_FLAG_NONE)); | 458 MOJO_WRITE_MESSAGE_FLAG_NONE)); |
475 | 459 |
476 BootstrapMessagePipeNoWait(0, mp0); | 460 BootstrapMessagePipeNoWait(0, mp0); |
477 | 461 |
478 // Close MP 0, port 0 before channel 1 is even connected. | 462 // Close MP 0, port 0 before channel 1 is even connected. |
479 mp0->Close(0); | 463 mp0->Close(0); |
480 | 464 |
481 scoped_refptr<MessagePipe> mp1(new MessagePipe( | 465 scoped_refptr<MessagePipe> mp1(MessagePipe::CreateProxyLocal()); |
482 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()), | |
483 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()))); | |
484 | 466 |
485 // Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do | 467 // Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do |
486 // it later, it might already be readable.) | 468 // it later, it might already be readable.) |
487 waiter.Init(); | 469 waiter.Init(); |
488 ASSERT_EQ(MOJO_RESULT_OK, | 470 ASSERT_EQ(MOJO_RESULT_OK, |
489 mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, NULL)); | 471 mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, NULL)); |
490 | 472 |
491 BootstrapMessagePipeNoWait(1, mp1); | 473 BootstrapMessagePipeNoWait(1, mp1); |
492 | 474 |
493 // Wait. | 475 // Wait. |
(...skipping 22 matching lines...) Expand all Loading... |
516 // And MP 1, port 1. | 498 // And MP 1, port 1. |
517 mp1->Close(1); | 499 mp1->Close(1); |
518 } | 500 } |
519 | 501 |
520 TEST_F(RemoteMessagePipeTest, HandlePassing) { | 502 TEST_F(RemoteMessagePipeTest, HandlePassing) { |
521 static const char kHello[] = "hello"; | 503 static const char kHello[] = "hello"; |
522 Waiter waiter; | 504 Waiter waiter; |
523 HandleSignalsState hss; | 505 HandleSignalsState hss; |
524 uint32_t context = 0; | 506 uint32_t context = 0; |
525 | 507 |
526 scoped_refptr<MessagePipe> mp0(new MessagePipe( | 508 scoped_refptr<MessagePipe> mp0(MessagePipe::CreateLocalProxy()); |
527 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()), | 509 scoped_refptr<MessagePipe> mp1(MessagePipe::CreateProxyLocal()); |
528 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()))); | |
529 scoped_refptr<MessagePipe> mp1(new MessagePipe( | |
530 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()), | |
531 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()))); | |
532 ConnectMessagePipes(mp0, mp1); | 510 ConnectMessagePipes(mp0, mp1); |
533 | 511 |
534 // We'll try to pass this dispatcher. | 512 // We'll try to pass this dispatcher. |
535 scoped_refptr<MessagePipeDispatcher> dispatcher( | 513 scoped_refptr<MessagePipeDispatcher> dispatcher( |
536 new MessagePipeDispatcher(MessagePipeDispatcher::kDefaultCreateOptions)); | 514 new MessagePipeDispatcher(MessagePipeDispatcher::kDefaultCreateOptions)); |
537 scoped_refptr<MessagePipe> local_mp(new MessagePipe()); | 515 scoped_refptr<MessagePipe> local_mp(MessagePipe::CreateLocalLocal()); |
538 dispatcher->Init(local_mp, 0); | 516 dispatcher->Init(local_mp, 0); |
539 | 517 |
540 // Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do | 518 // Prepare to wait on MP 1, port 1. (Add the waiter now. Otherwise, if we do |
541 // it later, it might already be readable.) | 519 // it later, it might already be readable.) |
542 waiter.Init(); | 520 waiter.Init(); |
543 ASSERT_EQ(MOJO_RESULT_OK, | 521 ASSERT_EQ(MOJO_RESULT_OK, |
544 mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, NULL)); | 522 mp1->AddWaiter(1, &waiter, MOJO_HANDLE_SIGNAL_READABLE, 123, NULL)); |
545 | 523 |
546 // Write to MP 0, port 0. | 524 // Write to MP 0, port 0. |
547 { | 525 { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 #else | 666 #else |
689 // Not yet implemented (on Windows). | 667 // Not yet implemented (on Windows). |
690 #define MAYBE_SharedBufferPassing DISABLED_SharedBufferPassing | 668 #define MAYBE_SharedBufferPassing DISABLED_SharedBufferPassing |
691 #endif | 669 #endif |
692 TEST_F(RemoteMessagePipeTest, MAYBE_SharedBufferPassing) { | 670 TEST_F(RemoteMessagePipeTest, MAYBE_SharedBufferPassing) { |
693 static const char kHello[] = "hello"; | 671 static const char kHello[] = "hello"; |
694 Waiter waiter; | 672 Waiter waiter; |
695 HandleSignalsState hss; | 673 HandleSignalsState hss; |
696 uint32_t context = 0; | 674 uint32_t context = 0; |
697 | 675 |
698 scoped_refptr<MessagePipe> mp0(new MessagePipe( | 676 scoped_refptr<MessagePipe> mp0(MessagePipe::CreateLocalProxy()); |
699 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()), | 677 scoped_refptr<MessagePipe> mp1(MessagePipe::CreateProxyLocal()); |
700 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()))); | |
701 scoped_refptr<MessagePipe> mp1(new MessagePipe( | |
702 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()), | |
703 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()))); | |
704 ConnectMessagePipes(mp0, mp1); | 678 ConnectMessagePipes(mp0, mp1); |
705 | 679 |
706 // We'll try to pass this dispatcher. | 680 // We'll try to pass this dispatcher. |
707 scoped_refptr<SharedBufferDispatcher> dispatcher; | 681 scoped_refptr<SharedBufferDispatcher> dispatcher; |
708 EXPECT_EQ(MOJO_RESULT_OK, | 682 EXPECT_EQ(MOJO_RESULT_OK, |
709 SharedBufferDispatcher::Create( | 683 SharedBufferDispatcher::Create( |
710 platform_support(), | 684 platform_support(), |
711 SharedBufferDispatcher::kDefaultCreateOptions, | 685 SharedBufferDispatcher::kDefaultCreateOptions, |
712 100, | 686 100, |
713 &dispatcher)); | 687 &dispatcher)); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 TEST_F(RemoteMessagePipeTest, MAYBE_PlatformHandlePassing) { | 800 TEST_F(RemoteMessagePipeTest, MAYBE_PlatformHandlePassing) { |
827 base::ScopedTempDir temp_dir; | 801 base::ScopedTempDir temp_dir; |
828 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 802 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
829 | 803 |
830 static const char kHello[] = "hello"; | 804 static const char kHello[] = "hello"; |
831 static const char kWorld[] = "world"; | 805 static const char kWorld[] = "world"; |
832 Waiter waiter; | 806 Waiter waiter; |
833 uint32_t context = 0; | 807 uint32_t context = 0; |
834 HandleSignalsState hss; | 808 HandleSignalsState hss; |
835 | 809 |
836 scoped_refptr<MessagePipe> mp0(new MessagePipe( | 810 scoped_refptr<MessagePipe> mp0(MessagePipe::CreateLocalProxy()); |
837 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()), | 811 scoped_refptr<MessagePipe> mp1(MessagePipe::CreateProxyLocal()); |
838 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()))); | |
839 scoped_refptr<MessagePipe> mp1(new MessagePipe( | |
840 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()), | |
841 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()))); | |
842 ConnectMessagePipes(mp0, mp1); | 812 ConnectMessagePipes(mp0, mp1); |
843 | 813 |
844 base::FilePath unused; | 814 base::FilePath unused; |
845 base::ScopedFILE fp( | 815 base::ScopedFILE fp( |
846 CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused)); | 816 CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused)); |
847 EXPECT_EQ(sizeof(kHello), fwrite(kHello, 1, sizeof(kHello), fp.get())); | 817 EXPECT_EQ(sizeof(kHello), fwrite(kHello, 1, sizeof(kHello), fp.get())); |
848 // We'll try to pass this dispatcher, which will cause a |PlatformHandle| to | 818 // We'll try to pass this dispatcher, which will cause a |PlatformHandle| to |
849 // be passed. | 819 // be passed. |
850 scoped_refptr<PlatformHandleDispatcher> dispatcher( | 820 scoped_refptr<PlatformHandleDispatcher> dispatcher( |
851 new PlatformHandleDispatcher( | 821 new PlatformHandleDispatcher( |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 | 903 |
934 // Test racing closes (on each end). | 904 // Test racing closes (on each end). |
935 // Note: A flaky failure would almost certainly indicate a problem in the code | 905 // Note: A flaky failure would almost certainly indicate a problem in the code |
936 // itself (not in the test). Also, any logged warnings/errors would also | 906 // itself (not in the test). Also, any logged warnings/errors would also |
937 // probably be indicative of bugs. | 907 // probably be indicative of bugs. |
938 TEST_F(RemoteMessagePipeTest, RacingClosesStress) { | 908 TEST_F(RemoteMessagePipeTest, RacingClosesStress) { |
939 base::TimeDelta delay = base::TimeDelta::FromMilliseconds(5); | 909 base::TimeDelta delay = base::TimeDelta::FromMilliseconds(5); |
940 | 910 |
941 for (unsigned i = 0; i < 256; i++) { | 911 for (unsigned i = 0; i < 256; i++) { |
942 DVLOG(2) << "---------------------------------------- " << i; | 912 DVLOG(2) << "---------------------------------------- " << i; |
943 scoped_refptr<MessagePipe> mp0(new MessagePipe( | 913 scoped_refptr<MessagePipe> mp0(MessagePipe::CreateLocalProxy()); |
944 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()), | |
945 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()))); | |
946 BootstrapMessagePipeNoWait(0, mp0); | 914 BootstrapMessagePipeNoWait(0, mp0); |
947 | 915 |
948 scoped_refptr<MessagePipe> mp1(new MessagePipe( | 916 scoped_refptr<MessagePipe> mp1(MessagePipe::CreateProxyLocal()); |
949 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()), | |
950 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()))); | |
951 BootstrapMessagePipeNoWait(1, mp1); | 917 BootstrapMessagePipeNoWait(1, mp1); |
952 | 918 |
953 if (i & 1u) { | 919 if (i & 1u) { |
954 io_thread()->task_runner()->PostTask( | 920 io_thread()->task_runner()->PostTask( |
955 FROM_HERE, base::Bind(&base::PlatformThread::Sleep, delay)); | 921 FROM_HERE, base::Bind(&base::PlatformThread::Sleep, delay)); |
956 } | 922 } |
957 if (i & 2u) | 923 if (i & 2u) |
958 base::PlatformThread::Sleep(delay); | 924 base::PlatformThread::Sleep(delay); |
959 | 925 |
960 mp0->Close(0); | 926 mp0->Close(0); |
961 | 927 |
962 if (i & 4u) { | 928 if (i & 4u) { |
963 io_thread()->task_runner()->PostTask( | 929 io_thread()->task_runner()->PostTask( |
964 FROM_HERE, base::Bind(&base::PlatformThread::Sleep, delay)); | 930 FROM_HERE, base::Bind(&base::PlatformThread::Sleep, delay)); |
965 } | 931 } |
966 if (i & 8u) | 932 if (i & 8u) |
967 base::PlatformThread::Sleep(delay); | 933 base::PlatformThread::Sleep(delay); |
968 | 934 |
969 mp1->Close(1); | 935 mp1->Close(1); |
970 | 936 |
971 RestoreInitialState(); | 937 RestoreInitialState(); |
972 } | 938 } |
973 } | 939 } |
974 | 940 |
975 } // namespace | 941 } // namespace |
976 } // namespace system | 942 } // namespace system |
977 } // namespace mojo | 943 } // namespace mojo |
OLD | NEW |