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

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

Issue 488003003: Add ChannelProxy benchmark to ipc_perftests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Landing. 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/channel_unittest.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 "mojo/common/test/multiprocess_test_helper.h" 9 #include "mojo/common/test/multiprocess_test_helper.h"
9 #include "mojo/embedder/simple_platform_support.h" 10 #include "mojo/embedder/simple_platform_support.h"
10 #include "mojo/system/channel.h" 11 #include "mojo/system/channel.h"
11 #include "mojo/system/message_pipe.h" 12 #include "mojo/system/message_pipe.h"
12 #include "mojo/system/test_utils.h" 13 #include "mojo/system/test_utils.h"
13 14
14 namespace mojo { 15 namespace mojo {
15 namespace system { 16 namespace system {
16 namespace test { 17 namespace test {
17 18
18 MojoResult WaitIfNecessary(scoped_refptr<MessagePipe> mp, 19 MojoResult WaitIfNecessary(scoped_refptr<MessagePipe> mp,
19 MojoHandleSignals signals, 20 MojoHandleSignals signals,
20 HandleSignalsState* signals_state); 21 HandleSignalsState* signals_state);
21 22
22 class ChannelThread { 23 class ChannelThread {
23 public: 24 public:
24 explicit ChannelThread(embedder::PlatformSupport* platform_support); 25 explicit ChannelThread(embedder::PlatformSupport* platform_support);
25 ~ChannelThread(); 26 ~ChannelThread();
26 27
27 void Start(embedder::ScopedPlatformHandle platform_handle, 28 void Start(embedder::ScopedPlatformHandle platform_handle,
28 scoped_refptr<MessagePipe> message_pipe); 29 scoped_refptr<MessagePipe> message_pipe);
29 void Stop(); 30 void Stop();
30 31
31 private: 32 private:
32 void InitChannelOnIOThread(embedder::ScopedPlatformHandle platform_handle, 33 void InitChannelOnIOThread(embedder::ScopedPlatformHandle platform_handle,
33 scoped_refptr<MessagePipe> message_pipe); 34 scoped_refptr<MessagePipe> message_pipe);
34 void ShutdownChannelOnIOThread(); 35 void ShutdownChannelOnIOThread();
35 36
36 embedder::PlatformSupport* const platform_support_; 37 embedder::PlatformSupport* const platform_support_;
37 TestIOThread test_io_thread_; 38 base::TestIOThread test_io_thread_;
38 scoped_refptr<Channel> channel_; 39 scoped_refptr<Channel> channel_;
39 40
40 DISALLOW_COPY_AND_ASSIGN(ChannelThread); 41 DISALLOW_COPY_AND_ASSIGN(ChannelThread);
41 }; 42 };
42 43
43 class MultiprocessMessagePipeTestBase : public testing::Test { 44 class MultiprocessMessagePipeTestBase : public testing::Test {
44 public: 45 public:
45 MultiprocessMessagePipeTestBase(); 46 MultiprocessMessagePipeTestBase();
46 virtual ~MultiprocessMessagePipeTestBase(); 47 virtual ~MultiprocessMessagePipeTestBase();
47 48
48 protected: 49 protected:
49 void Init(scoped_refptr<MessagePipe> mp); 50 void Init(scoped_refptr<MessagePipe> mp);
50 51
51 embedder::PlatformSupport* platform_support() { return &platform_support_; } 52 embedder::PlatformSupport* platform_support() { return &platform_support_; }
52 mojo::test::MultiprocessTestHelper* helper() { return &helper_; } 53 mojo::test::MultiprocessTestHelper* helper() { return &helper_; }
53 54
54 private: 55 private:
55 embedder::SimplePlatformSupport platform_support_; 56 embedder::SimplePlatformSupport platform_support_;
56 ChannelThread channel_thread_; 57 ChannelThread channel_thread_;
57 mojo::test::MultiprocessTestHelper helper_; 58 mojo::test::MultiprocessTestHelper helper_;
58 59
59 DISALLOW_COPY_AND_ASSIGN(MultiprocessMessagePipeTestBase); 60 DISALLOW_COPY_AND_ASSIGN(MultiprocessMessagePipeTestBase);
60 }; 61 };
61 62
62 } // namespace test 63 } // namespace test
63 } // namespace system 64 } // namespace system
64 } // namespace mojo 65 } // namespace mojo
65 66
66 #endif // MOJO_SYSTEM_MESSAGE_PIPE_TEST_HELPER_H_ 67 #endif // MOJO_SYSTEM_MESSAGE_PIPE_TEST_HELPER_H_
OLDNEW
« no previous file with comments | « mojo/system/channel_unittest.cc ('k') | mojo/system/message_pipe_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698