| 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. |kEpsilonMicros| may be increased to increase | 6 // heavily-loaded system). Sorry. |kEpsilonMicros| may be increased to increase |
| 7 // tolerance and reduce observed flakiness. | 7 // tolerance and reduce observed flakiness. |
| 8 | 8 |
| 9 #include "mojo/system/message_pipe_dispatcher.h" | 9 #include "mojo/system/message_pipe_dispatcher.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "mojo/system/test_utils.h" | 22 #include "mojo/system/test_utils.h" |
| 23 #include "mojo/system/waiter.h" | 23 #include "mojo/system/waiter.h" |
| 24 #include "mojo/system/waiter_test_utils.h" | 24 #include "mojo/system/waiter_test_utils.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 namespace mojo { | 27 namespace mojo { |
| 28 namespace system { | 28 namespace system { |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 const int64_t kMicrosPerMs = 1000; | 31 const int64_t kMicrosPerMs = 1000; |
| 32 const int64_t kEpsilonMicros = 15 * kMicrosPerMs; // 15 ms. | 32 const int64_t kEpsilonMicros = 30 * kMicrosPerMs; // 30 ms. |
| 33 | 33 |
| 34 TEST(MessagePipeDispatcherTest, Basic) { | 34 TEST(MessagePipeDispatcherTest, Basic) { |
| 35 test::Stopwatch stopwatch; | 35 test::Stopwatch stopwatch; |
| 36 int32_t buffer[1]; | 36 int32_t buffer[1]; |
| 37 const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer)); | 37 const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer)); |
| 38 uint32_t buffer_size; | 38 uint32_t buffer_size; |
| 39 int64_t elapsed_micros; | 39 int64_t elapsed_micros; |
| 40 | 40 |
| 41 // Run this test both with |d0| as port 0, |d1| as port 1 and vice versa. | 41 // Run this test both with |d0| as port 0, |d1| as port 1 and vice versa. |
| 42 for (unsigned i = 0; i < 2; i++) { | 42 for (unsigned i = 0; i < 2; i++) { |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 EXPECT_EQ(total_messages_written, total_messages_read); | 578 EXPECT_EQ(total_messages_written, total_messages_read); |
| 579 EXPECT_EQ(total_bytes_written, total_bytes_read); | 579 EXPECT_EQ(total_bytes_written, total_bytes_read); |
| 580 | 580 |
| 581 EXPECT_EQ(MOJO_RESULT_OK, d_write->Close()); | 581 EXPECT_EQ(MOJO_RESULT_OK, d_write->Close()); |
| 582 EXPECT_EQ(MOJO_RESULT_OK, d_read->Close()); | 582 EXPECT_EQ(MOJO_RESULT_OK, d_read->Close()); |
| 583 } | 583 } |
| 584 | 584 |
| 585 } // namespace | 585 } // namespace |
| 586 } // namespace system | 586 } // namespace system |
| 587 } // namespace mojo | 587 } // namespace mojo |
| OLD | NEW |