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 #include "mojo/edk/system/message_pipe_test_utils.h" | 5 #include "mojo/edk/system/message_pipe_test_utils.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "mojo/edk/system/channel.h" | 10 #include "mojo/edk/system/channel.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 test_io_thread_.PostTaskAndWait(base::Bind( | 67 test_io_thread_.PostTaskAndWait(base::Bind( |
68 &ChannelThread::ShutdownChannelOnIOThread, base::Unretained(this))); | 68 &ChannelThread::ShutdownChannelOnIOThread, base::Unretained(this))); |
69 } | 69 } |
70 test_io_thread_.Stop(); | 70 test_io_thread_.Stop(); |
71 } | 71 } |
72 | 72 |
73 void ChannelThread::InitChannelOnIOThread( | 73 void ChannelThread::InitChannelOnIOThread( |
74 embedder::ScopedPlatformHandle platform_handle, | 74 embedder::ScopedPlatformHandle platform_handle, |
75 RefPtr<ChannelEndpoint> channel_endpoint) { | 75 RefPtr<ChannelEndpoint> channel_endpoint) { |
76 CHECK_EQ(base::MessageLoop::current(), test_io_thread_.message_loop()); | 76 CHECK(test_io_thread_.IsCurrentAndRunning()); |
77 CHECK(platform_handle.is_valid()); | 77 CHECK(platform_handle.is_valid()); |
78 | 78 |
79 // Create and initialize |Channel|. | 79 // Create and initialize |Channel|. |
80 channel_ = MakeRefCounted<Channel>(platform_support_); | 80 channel_ = MakeRefCounted<Channel>(platform_support_); |
81 channel_->Init(RawChannel::Create(platform_handle.Pass())); | 81 channel_->Init(RawChannel::Create(platform_handle.Pass())); |
82 | 82 |
83 // Start the bootstrap endpoint. | 83 // Start the bootstrap endpoint. |
84 // Note: On the "server" (parent process) side, we need not attach/run the | 84 // Note: On the "server" (parent process) side, we need not attach/run the |
85 // endpoint immediately. However, on the "client" (child process) side, this | 85 // endpoint immediately. However, on the "client" (child process) side, this |
86 // *must* be done here -- otherwise, the |Channel| may receive/process | 86 // *must* be done here -- otherwise, the |Channel| may receive/process |
(...skipping 17 matching lines...) Expand all Loading... |
104 } | 104 } |
105 | 105 |
106 void MultiprocessMessagePipeTestBase::Init(RefPtr<ChannelEndpoint>&& ep) { | 106 void MultiprocessMessagePipeTestBase::Init(RefPtr<ChannelEndpoint>&& ep) { |
107 channel_thread_.Start(helper_.server_platform_handle.Pass(), std::move(ep)); | 107 channel_thread_.Start(helper_.server_platform_handle.Pass(), std::move(ep)); |
108 } | 108 } |
109 #endif | 109 #endif |
110 | 110 |
111 } // namespace test | 111 } // namespace test |
112 } // namespace system | 112 } // namespace system |
113 } // namespace mojo | 113 } // namespace mojo |
OLD | NEW |