| 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 "mojo/edk/system/raw_channel.h" | 5 #include "mojo/edk/system/raw_channel.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "mojo/edk/embedder/platform_channel_pair.h" | |
| 16 #include "mojo/edk/platform/platform_handle.h" | 15 #include "mojo/edk/platform/platform_handle.h" |
| 16 #include "mojo/edk/platform/platform_pipe.h" |
| 17 #include "mojo/edk/platform/scoped_platform_handle.h" | 17 #include "mojo/edk/platform/scoped_platform_handle.h" |
| 18 #include "mojo/edk/platform/thread_utils.h" | 18 #include "mojo/edk/platform/thread_utils.h" |
| 19 #include "mojo/edk/system/message_in_transit.h" | 19 #include "mojo/edk/system/message_in_transit.h" |
| 20 #include "mojo/edk/system/test/random.h" | 20 #include "mojo/edk/system/test/random.h" |
| 21 #include "mojo/edk/system/test/scoped_test_dir.h" | 21 #include "mojo/edk/system/test/scoped_test_dir.h" |
| 22 #include "mojo/edk/system/test/simple_test_thread.h" | 22 #include "mojo/edk/system/test/simple_test_thread.h" |
| 23 #include "mojo/edk/system/test/test_io_thread.h" | 23 #include "mojo/edk/system/test/test_io_thread.h" |
| 24 #include "mojo/edk/system/test/timeouts.h" | 24 #include "mojo/edk/system/test/timeouts.h" |
| 25 #include "mojo/edk/system/transport_data.h" | 25 #include "mojo/edk/system/transport_data.h" |
| 26 #include "mojo/edk/test/test_utils.h" | 26 #include "mojo/edk/test/test_utils.h" |
| 27 #include "mojo/edk/util/make_unique.h" | 27 #include "mojo/edk/util/make_unique.h" |
| 28 #include "mojo/edk/util/mutex.h" | 28 #include "mojo/edk/util/mutex.h" |
| 29 #include "mojo/edk/util/scoped_file.h" | 29 #include "mojo/edk/util/scoped_file.h" |
| 30 #include "mojo/edk/util/waitable_event.h" | 30 #include "mojo/edk/util/waitable_event.h" |
| 31 #include "mojo/public/cpp/system/macros.h" | 31 #include "mojo/public/cpp/system/macros.h" |
| 32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 33 | 33 |
| 34 using mojo::platform::PlatformHandle; | 34 using mojo::platform::PlatformHandle; |
| 35 using mojo::platform::PlatformPipe; |
| 35 using mojo::platform::ScopedPlatformHandle; | 36 using mojo::platform::ScopedPlatformHandle; |
| 36 using mojo::platform::ThreadSleep; | 37 using mojo::platform::ThreadSleep; |
| 37 using mojo::util::AutoResetWaitableEvent; | 38 using mojo::util::AutoResetWaitableEvent; |
| 38 using mojo::util::MakeUnique; | 39 using mojo::util::MakeUnique; |
| 39 using mojo::util::Mutex; | 40 using mojo::util::Mutex; |
| 40 using mojo::util::MutexLocker; | 41 using mojo::util::MutexLocker; |
| 41 | 42 |
| 42 namespace mojo { | 43 namespace mojo { |
| 43 namespace system { | 44 namespace system { |
| 44 namespace { | 45 namespace { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 73 } | 74 } |
| 74 | 75 |
| 75 // ----------------------------------------------------------------------------- | 76 // ----------------------------------------------------------------------------- |
| 76 | 77 |
| 77 class RawChannelTest : public testing::Test { | 78 class RawChannelTest : public testing::Test { |
| 78 public: | 79 public: |
| 79 RawChannelTest() : io_thread_(test::TestIOThread::StartMode::MANUAL) {} | 80 RawChannelTest() : io_thread_(test::TestIOThread::StartMode::MANUAL) {} |
| 80 ~RawChannelTest() override {} | 81 ~RawChannelTest() override {} |
| 81 | 82 |
| 82 void SetUp() override { | 83 void SetUp() override { |
| 83 embedder::PlatformChannelPair channel_pair; | 84 PlatformPipe channel_pair; |
| 84 handles[0] = channel_pair.handle0.Pass(); | 85 handles[0] = channel_pair.handle0.Pass(); |
| 85 handles[1] = channel_pair.handle1.Pass(); | 86 handles[1] = channel_pair.handle1.Pass(); |
| 86 io_thread_.Start(); | 87 io_thread_.Start(); |
| 87 } | 88 } |
| 88 | 89 |
| 89 void TearDown() override { | 90 void TearDown() override { |
| 90 io_thread_.Stop(); | 91 io_thread_.Stop(); |
| 91 handles[0].reset(); | 92 handles[0].reset(); |
| 92 handles[1].reset(); | 93 handles[1].reset(); |
| 93 } | 94 } |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 | 841 |
| 841 read_delegate.Wait(); | 842 read_delegate.Wait(); |
| 842 | 843 |
| 843 io_thread()->PostTaskAndWait([&rc_read]() { rc_read->Shutdown(); }); | 844 io_thread()->PostTaskAndWait([&rc_read]() { rc_read->Shutdown(); }); |
| 844 io_thread()->PostTaskAndWait([&rc_write]() { rc_write->Shutdown(); }); | 845 io_thread()->PostTaskAndWait([&rc_write]() { rc_write->Shutdown(); }); |
| 845 } | 846 } |
| 846 | 847 |
| 847 } // namespace | 848 } // namespace |
| 848 } // namespace system | 849 } // namespace system |
| 849 } // namespace mojo | 850 } // namespace mojo |
| OLD | NEW |