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

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

Issue 1423713009: EDK: Move ref counting classes to mojo/edk/util. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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/edk/system/message_pipe_perftest.cc ('k') | mojo/edk/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_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/system/channel.h" 9 #include "mojo/edk/system/channel.h"
10 #include "mojo/edk/system/ref_ptr.h"
11 #include "mojo/edk/system/test/test_io_thread.h" 10 #include "mojo/edk/system/test/test_io_thread.h"
12 #include "mojo/edk/test/multiprocess_test_helper.h" 11 #include "mojo/edk/test/multiprocess_test_helper.h"
12 #include "mojo/edk/util/ref_ptr.h"
13 #include "mojo/public/cpp/system/macros.h" 13 #include "mojo/public/cpp/system/macros.h"
14 14
15 namespace mojo { 15 namespace mojo {
16 namespace system { 16 namespace system {
17 17
18 class Channel; 18 class Channel;
19 class ChannelEndpoint; 19 class ChannelEndpoint;
20 class MessagePipe; 20 class MessagePipe;
21 21
22 namespace test { 22 namespace test {
23 23
24 MojoResult WaitIfNecessary(MessagePipe* mp, 24 MojoResult WaitIfNecessary(MessagePipe* mp,
25 MojoHandleSignals signals, 25 MojoHandleSignals signals,
26 HandleSignalsState* signals_state); 26 HandleSignalsState* signals_state);
27 27
28 class ChannelThread { 28 class ChannelThread {
29 public: 29 public:
30 explicit ChannelThread(embedder::PlatformSupport* platform_support); 30 explicit ChannelThread(embedder::PlatformSupport* platform_support);
31 ~ChannelThread(); 31 ~ChannelThread();
32 32
33 void Start(embedder::ScopedPlatformHandle platform_handle, 33 void Start(embedder::ScopedPlatformHandle platform_handle,
34 RefPtr<ChannelEndpoint>&& channel_endpoint); 34 util::RefPtr<ChannelEndpoint>&& channel_endpoint);
35 void Stop(); 35 void Stop();
36 36
37 private: 37 private:
38 // TODO(vtl): |channel_endpoint| should be an rvalue reference, but that 38 // TODO(vtl): |channel_endpoint| should be an rvalue reference, but that
39 // doesn't currently work correctly with base::Bind. 39 // doesn't currently work correctly with base::Bind.
40 void InitChannelOnIOThread(embedder::ScopedPlatformHandle platform_handle, 40 void InitChannelOnIOThread(embedder::ScopedPlatformHandle platform_handle,
41 RefPtr<ChannelEndpoint> channel_endpoint); 41 util::RefPtr<ChannelEndpoint> channel_endpoint);
42 void ShutdownChannelOnIOThread(); 42 void ShutdownChannelOnIOThread();
43 43
44 embedder::PlatformSupport* const platform_support_; 44 embedder::PlatformSupport* const platform_support_;
45 TestIOThread test_io_thread_; 45 TestIOThread test_io_thread_;
46 RefPtr<Channel> channel_; 46 util::RefPtr<Channel> channel_;
47 47
48 MOJO_DISALLOW_COPY_AND_ASSIGN(ChannelThread); 48 MOJO_DISALLOW_COPY_AND_ASSIGN(ChannelThread);
49 }; 49 };
50 50
51 #if !defined(OS_IOS) 51 #if !defined(OS_IOS)
52 class MultiprocessMessagePipeTestBase : public testing::Test { 52 class MultiprocessMessagePipeTestBase : public testing::Test {
53 public: 53 public:
54 MultiprocessMessagePipeTestBase(); 54 MultiprocessMessagePipeTestBase();
55 ~MultiprocessMessagePipeTestBase() override; 55 ~MultiprocessMessagePipeTestBase() override;
56 56
57 protected: 57 protected:
58 void Init(RefPtr<ChannelEndpoint>&& ep); 58 void Init(util::RefPtr<ChannelEndpoint>&& ep);
59 59
60 embedder::PlatformSupport* platform_support() { return &platform_support_; } 60 embedder::PlatformSupport* platform_support() { return &platform_support_; }
61 mojo::test::MultiprocessTestHelper* helper() { return &helper_; } 61 mojo::test::MultiprocessTestHelper* helper() { return &helper_; }
62 62
63 private: 63 private:
64 embedder::SimplePlatformSupport platform_support_; 64 embedder::SimplePlatformSupport platform_support_;
65 ChannelThread channel_thread_; 65 ChannelThread channel_thread_;
66 mojo::test::MultiprocessTestHelper helper_; 66 mojo::test::MultiprocessTestHelper helper_;
67 67
68 MOJO_DISALLOW_COPY_AND_ASSIGN(MultiprocessMessagePipeTestBase); 68 MOJO_DISALLOW_COPY_AND_ASSIGN(MultiprocessMessagePipeTestBase);
69 }; 69 };
70 #endif 70 #endif
71 71
72 } // namespace test 72 } // namespace test
73 } // namespace system 73 } // namespace system
74 } // namespace mojo 74 } // namespace mojo
75 75
76 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_ 76 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/message_pipe_perftest.cc ('k') | mojo/edk/system/message_pipe_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698