| 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 #ifndef MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_ | 5 #ifndef MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_ |
| 6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_ | 6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include "mojo/edk/embedder/simple_platform_support.h" | 8 #include "mojo/edk/embedder/simple_platform_support.h" |
| 9 #include "mojo/edk/platform/scoped_platform_handle.h" |
| 9 #include "mojo/edk/system/channel.h" | 10 #include "mojo/edk/system/channel.h" |
| 10 #include "mojo/edk/system/test/test_io_thread.h" | 11 #include "mojo/edk/system/test/test_io_thread.h" |
| 11 #include "mojo/edk/test/multiprocess_test_helper.h" | 12 #include "mojo/edk/test/multiprocess_test_helper.h" |
| 12 #include "mojo/edk/util/ref_ptr.h" | 13 #include "mojo/edk/util/ref_ptr.h" |
| 13 #include "mojo/public/cpp/system/macros.h" | 14 #include "mojo/public/cpp/system/macros.h" |
| 14 | 15 |
| 15 namespace mojo { | 16 namespace mojo { |
| 16 namespace system { | 17 namespace system { |
| 17 | 18 |
| 18 class Channel; | 19 class Channel; |
| 19 class ChannelEndpoint; | 20 class ChannelEndpoint; |
| 20 class MessagePipe; | 21 class MessagePipe; |
| 21 | 22 |
| 22 namespace test { | 23 namespace test { |
| 23 | 24 |
| 24 MojoResult WaitIfNecessary(MessagePipe* mp, | 25 MojoResult WaitIfNecessary(MessagePipe* mp, |
| 25 MojoHandleSignals signals, | 26 MojoHandleSignals signals, |
| 26 HandleSignalsState* signals_state); | 27 HandleSignalsState* signals_state); |
| 27 | 28 |
| 28 class ChannelThread { | 29 class ChannelThread { |
| 29 public: | 30 public: |
| 30 explicit ChannelThread(embedder::PlatformSupport* platform_support); | 31 explicit ChannelThread(embedder::PlatformSupport* platform_support); |
| 31 ~ChannelThread(); | 32 ~ChannelThread(); |
| 32 | 33 |
| 33 void Start(embedder::ScopedPlatformHandle platform_handle, | 34 void Start(platform::ScopedPlatformHandle platform_handle, |
| 34 util::RefPtr<ChannelEndpoint>&& channel_endpoint); | 35 util::RefPtr<ChannelEndpoint>&& channel_endpoint); |
| 35 void Stop(); | 36 void Stop(); |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 // TODO(vtl): |channel_endpoint| should be an rvalue reference, but that | 39 // TODO(vtl): |channel_endpoint| should be an rvalue reference, but that |
| 39 // doesn't currently work correctly with base::Bind. | 40 // doesn't currently work correctly with base::Bind. |
| 40 void InitChannelOnIOThread(embedder::ScopedPlatformHandle platform_handle, | 41 void InitChannelOnIOThread(platform::ScopedPlatformHandle platform_handle, |
| 41 util::RefPtr<ChannelEndpoint> channel_endpoint); | 42 util::RefPtr<ChannelEndpoint> channel_endpoint); |
| 42 void ShutdownChannelOnIOThread(); | 43 void ShutdownChannelOnIOThread(); |
| 43 | 44 |
| 44 embedder::PlatformSupport* const platform_support_; | 45 embedder::PlatformSupport* const platform_support_; |
| 45 TestIOThread test_io_thread_; | 46 TestIOThread test_io_thread_; |
| 46 util::RefPtr<Channel> channel_; | 47 util::RefPtr<Channel> channel_; |
| 47 | 48 |
| 48 MOJO_DISALLOW_COPY_AND_ASSIGN(ChannelThread); | 49 MOJO_DISALLOW_COPY_AND_ASSIGN(ChannelThread); |
| 49 }; | 50 }; |
| 50 | 51 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 67 | 68 |
| 68 MOJO_DISALLOW_COPY_AND_ASSIGN(MultiprocessMessagePipeTestBase); | 69 MOJO_DISALLOW_COPY_AND_ASSIGN(MultiprocessMessagePipeTestBase); |
| 69 }; | 70 }; |
| 70 #endif | 71 #endif |
| 71 | 72 |
| 72 } // namespace test | 73 } // namespace test |
| 73 } // namespace system | 74 } // namespace system |
| 74 } // namespace mojo | 75 } // namespace mojo |
| 75 | 76 |
| 76 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_ | 77 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_ |
| OLD | NEW |