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
3 // found in the LICENSE file.
5 #ifndef MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_
6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_
8 #include "base/test/test_io_thread.h"
9 #include "mojo/edk/embedder/simple_platform_support.h"
10 #include "mojo/edk/system/channel.h"
11 #include "mojo/edk/system/test_utils.h"
12 #include "mojo/edk/test/multiprocess_test_helper.h"
18 class ChannelEndpoint
;
23 MojoResult
WaitIfNecessary(scoped_refptr
<MessagePipe
> mp
,
24 MojoHandleSignals signals
,
25 HandleSignalsState
* signals_state
);
29 explicit ChannelThread(embedder::PlatformSupport
* platform_support
);
32 void Start(embedder::ScopedPlatformHandle platform_handle
,
33 scoped_refptr
<ChannelEndpoint
> channel_endpoint
);
37 void InitChannelOnIOThread(embedder::ScopedPlatformHandle platform_handle
,
38 scoped_refptr
<ChannelEndpoint
> channel_endpoint
);
39 void ShutdownChannelOnIOThread();
41 embedder::PlatformSupport
* const platform_support_
;
42 base::TestIOThread test_io_thread_
;
43 scoped_refptr
<Channel
> channel_
;
45 DISALLOW_COPY_AND_ASSIGN(ChannelThread
);
49 class MultiprocessMessagePipeTestBase
: public testing::Test
{
51 MultiprocessMessagePipeTestBase();
52 ~MultiprocessMessagePipeTestBase() override
;
55 void Init(scoped_refptr
<ChannelEndpoint
> ep
);
57 embedder::PlatformSupport
* platform_support() { return &platform_support_
; }
58 mojo::test::MultiprocessTestHelper
* helper() { return &helper_
; }
61 embedder::SimplePlatformSupport platform_support_
;
62 ChannelThread channel_thread_
;
63 mojo::test::MultiprocessTestHelper helper_
;
65 DISALLOW_COPY_AND_ASSIGN(MultiprocessMessagePipeTestBase
);
73 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_