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/system/message_pipe_dispatcher.h" |
11 | 11 |
12 #include <string.h> | 12 #include <string.h> |
13 | 13 |
14 #include <limits> | 14 #include <limits> |
15 | 15 |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
18 #include "base/rand_util.h" | 18 #include "base/rand_util.h" |
19 #include "base/threading/platform_thread.h" // For |Sleep()|. | 19 #include "base/threading/platform_thread.h" // For |Sleep()|. |
20 #include "base/threading/simple_thread.h" | 20 #include "base/threading/simple_thread.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "mojo/edk/system/message_pipe.h" | 22 #include "mojo/system/message_pipe.h" |
23 #include "mojo/edk/system/test_utils.h" | 23 #include "mojo/system/test_utils.h" |
24 #include "mojo/edk/system/waiter.h" | 24 #include "mojo/system/waiter.h" |
25 #include "mojo/edk/system/waiter_test_utils.h" | 25 #include "mojo/system/waiter_test_utils.h" |
26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
27 | 27 |
28 namespace mojo { | 28 namespace mojo { |
29 namespace system { | 29 namespace system { |
30 namespace { | 30 namespace { |
31 | 31 |
32 TEST(MessagePipeDispatcherTest, Basic) { | 32 TEST(MessagePipeDispatcherTest, Basic) { |
33 test::Stopwatch stopwatch; | 33 test::Stopwatch stopwatch; |
34 int32_t buffer[1]; | 34 int32_t buffer[1]; |
35 const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer)); | 35 const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer)); |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 EXPECT_EQ(total_messages_written, total_messages_read); | 720 EXPECT_EQ(total_messages_written, total_messages_read); |
721 EXPECT_EQ(total_bytes_written, total_bytes_read); | 721 EXPECT_EQ(total_bytes_written, total_bytes_read); |
722 | 722 |
723 EXPECT_EQ(MOJO_RESULT_OK, d_write->Close()); | 723 EXPECT_EQ(MOJO_RESULT_OK, d_write->Close()); |
724 EXPECT_EQ(MOJO_RESULT_OK, d_read->Close()); | 724 EXPECT_EQ(MOJO_RESULT_OK, d_read->Close()); |
725 } | 725 } |
726 | 726 |
727 } // namespace | 727 } // namespace |
728 } // namespace system | 728 } // namespace system |
729 } // namespace mojo | 729 } // namespace mojo |
OLD | NEW |