| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a | 5 // NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a |
| 6 // heavily-loaded system). Sorry. |test::EpsilonTimeout()| may be increased to | 6 // heavily-loaded system). Sorry. |test::EpsilonTimeout()| may be increased to |
| 7 // increase tolerance and reduce observed flakiness (though doing so reduces the | 7 // increase tolerance and reduce observed flakiness (though doing so reduces the |
| 8 // meaningfulness of the test). | 8 // meaningfulness of the test). |
| 9 | 9 |
| 10 #include "mojo/edk/system/message_pipe_dispatcher.h" | 10 #include "mojo/edk/system/message_pipe_dispatcher.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 TEST(MessagePipeDispatcherTest, Basic) { | 36 TEST(MessagePipeDispatcherTest, Basic) { |
| 37 test::Stopwatch stopwatch; | 37 test::Stopwatch stopwatch; |
| 38 int32_t buffer[1]; | 38 int32_t buffer[1]; |
| 39 const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer)); | 39 const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer)); |
| 40 uint32_t buffer_size; | 40 uint32_t buffer_size; |
| 41 | 41 |
| 42 // Run this test both with |d0| as port 0, |d1| as port 1 and vice versa. | 42 // Run this test both with |d0| as port 0, |d1| as port 1 and vice versa. |
| 43 for (unsigned i = 0; i < 2; i++) { | 43 for (unsigned i = 0; i < 2; i++) { |
| 44 scoped_refptr<MessagePipeDispatcher> d0(new MessagePipeDispatcher( | 44 scoped_refptr<MessagePipeDispatcher> d0(new MessagePipeDispatcher( |
| 45 MessagePipeDispatcher::kDefaultCreateOptions)); | 45 MessagePipeDispatcher::kDefaultCreateOptions)); |
| 46 EXPECT_EQ(Dispatcher::kTypeMessagePipe, d0->GetType()); | 46 EXPECT_EQ(Dispatcher::Type::MESSAGE_PIPE, d0->GetType()); |
| 47 scoped_refptr<MessagePipeDispatcher> d1(new MessagePipeDispatcher( | 47 scoped_refptr<MessagePipeDispatcher> d1(new MessagePipeDispatcher( |
| 48 MessagePipeDispatcher::kDefaultCreateOptions)); | 48 MessagePipeDispatcher::kDefaultCreateOptions)); |
| 49 { | 49 { |
| 50 scoped_refptr<MessagePipe> mp(MessagePipe::CreateLocalLocal()); | 50 scoped_refptr<MessagePipe> mp(MessagePipe::CreateLocalLocal()); |
| 51 d0->Init(mp, i); // 0, 1. | 51 d0->Init(mp, i); // 0, 1. |
| 52 d1->Init(mp, i ^ 1); // 1, 0. | 52 d1->Init(mp, i ^ 1); // 1, 0. |
| 53 } | 53 } |
| 54 Waiter w; | 54 Waiter w; |
| 55 uint32_t context = 0; | 55 uint32_t context = 0; |
| 56 HandleSignalsState hss; | 56 HandleSignalsState hss; |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 EXPECT_EQ(total_messages_written, total_messages_read); | 682 EXPECT_EQ(total_messages_written, total_messages_read); |
| 683 EXPECT_EQ(total_bytes_written, total_bytes_read); | 683 EXPECT_EQ(total_bytes_written, total_bytes_read); |
| 684 | 684 |
| 685 EXPECT_EQ(MOJO_RESULT_OK, d_write->Close()); | 685 EXPECT_EQ(MOJO_RESULT_OK, d_write->Close()); |
| 686 EXPECT_EQ(MOJO_RESULT_OK, d_read->Close()); | 686 EXPECT_EQ(MOJO_RESULT_OK, d_read->Close()); |
| 687 } | 687 } |
| 688 | 688 |
| 689 } // namespace | 689 } // namespace |
| 690 } // namespace system | 690 } // namespace system |
| 691 } // namespace mojo | 691 } // namespace mojo |
| OLD | NEW |