Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Side by Side Diff: mojo/system/message_pipe_test_utils.h

Issue 588193004: Mojo: Have |ProxyMessagePipeEndpoint|s constructed with a |ChannelEndpoint|. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/system/message_pipe_perftest.cc ('k') | mojo/system/message_pipe_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_ 5 #ifndef MOJO_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_
6 #define MOJO_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_ 6 #define MOJO_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_
7 7
8 #include "base/test/test_io_thread.h" 8 #include "base/test/test_io_thread.h"
9 #include "mojo/common/test/multiprocess_test_helper.h" 9 #include "mojo/common/test/multiprocess_test_helper.h"
10 #include "mojo/embedder/simple_platform_support.h" 10 #include "mojo/embedder/simple_platform_support.h"
11 #include "mojo/system/channel.h" 11 #include "mojo/system/channel.h"
12 #include "mojo/system/message_pipe.h"
13 #include "mojo/system/test_utils.h" 12 #include "mojo/system/test_utils.h"
14 13
15 namespace mojo { 14 namespace mojo {
16 namespace system { 15 namespace system {
16
17 class Channel;
18 class ChannelEndpoint;
19 class MessagePipe;
20
17 namespace test { 21 namespace test {
18 22
19 MojoResult WaitIfNecessary(scoped_refptr<MessagePipe> mp, 23 MojoResult WaitIfNecessary(scoped_refptr<MessagePipe> mp,
20 MojoHandleSignals signals, 24 MojoHandleSignals signals,
21 HandleSignalsState* signals_state); 25 HandleSignalsState* signals_state);
22 26
23 class ChannelThread { 27 class ChannelThread {
24 public: 28 public:
25 explicit ChannelThread(embedder::PlatformSupport* platform_support); 29 explicit ChannelThread(embedder::PlatformSupport* platform_support);
26 ~ChannelThread(); 30 ~ChannelThread();
27 31
28 void Start(embedder::ScopedPlatformHandle platform_handle, 32 void Start(embedder::ScopedPlatformHandle platform_handle,
29 scoped_refptr<MessagePipe> message_pipe); 33 scoped_refptr<ChannelEndpoint> channel_endpoint);
30 void Stop(); 34 void Stop();
31 35
32 private: 36 private:
33 void InitChannelOnIOThread(embedder::ScopedPlatformHandle platform_handle, 37 void InitChannelOnIOThread(embedder::ScopedPlatformHandle platform_handle,
34 scoped_refptr<MessagePipe> message_pipe); 38 scoped_refptr<ChannelEndpoint> channel_endpoint);
35 void ShutdownChannelOnIOThread(); 39 void ShutdownChannelOnIOThread();
36 40
37 embedder::PlatformSupport* const platform_support_; 41 embedder::PlatformSupport* const platform_support_;
38 base::TestIOThread test_io_thread_; 42 base::TestIOThread test_io_thread_;
39 scoped_refptr<Channel> channel_; 43 scoped_refptr<Channel> channel_;
40 44
41 DISALLOW_COPY_AND_ASSIGN(ChannelThread); 45 DISALLOW_COPY_AND_ASSIGN(ChannelThread);
42 }; 46 };
43 47
44 #if !defined(OS_IOS) 48 #if !defined(OS_IOS)
45 class MultiprocessMessagePipeTestBase : public testing::Test { 49 class MultiprocessMessagePipeTestBase : public testing::Test {
46 public: 50 public:
47 MultiprocessMessagePipeTestBase(); 51 MultiprocessMessagePipeTestBase();
48 virtual ~MultiprocessMessagePipeTestBase(); 52 virtual ~MultiprocessMessagePipeTestBase();
49 53
50 protected: 54 protected:
51 void Init(scoped_refptr<MessagePipe> mp); 55 void Init(scoped_refptr<ChannelEndpoint> ep);
52 56
53 embedder::PlatformSupport* platform_support() { return &platform_support_; } 57 embedder::PlatformSupport* platform_support() { return &platform_support_; }
54 mojo::test::MultiprocessTestHelper* helper() { return &helper_; } 58 mojo::test::MultiprocessTestHelper* helper() { return &helper_; }
55 59
56 private: 60 private:
57 embedder::SimplePlatformSupport platform_support_; 61 embedder::SimplePlatformSupport platform_support_;
58 ChannelThread channel_thread_; 62 ChannelThread channel_thread_;
59 mojo::test::MultiprocessTestHelper helper_; 63 mojo::test::MultiprocessTestHelper helper_;
60 64
61 DISALLOW_COPY_AND_ASSIGN(MultiprocessMessagePipeTestBase); 65 DISALLOW_COPY_AND_ASSIGN(MultiprocessMessagePipeTestBase);
62 }; 66 };
63 #endif 67 #endif
64 68
65 } // namespace test 69 } // namespace test
66 } // namespace system 70 } // namespace system
67 } // namespace mojo 71 } // namespace mojo
68 72
69 #endif // MOJO_SYSTEM_MESSAGE_PIPE_TEST_HELPER_H_ 73 #endif // MOJO_SYSTEM_MESSAGE_PIPE_TEST_HELPER_H_
OLDNEW
« no previous file with comments | « mojo/system/message_pipe_perftest.cc ('k') | mojo/system/message_pipe_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698