| 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/channel_manager.h" | 5 #include "mojo/edk/system/channel_manager.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | |
| 11 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 12 #include "base/task_runner.h" | 11 #include "base/task_runner.h" |
| 12 #include "base/thread_task_runner_handle.h" |
| 13 #include "base/threading/simple_thread.h" | 13 #include "base/threading/simple_thread.h" |
| 14 #include "mojo/edk/embedder/platform_channel_pair.h" | 14 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 15 #include "mojo/edk/embedder/simple_platform_support.h" | 15 #include "mojo/edk/embedder/simple_platform_support.h" |
| 16 #include "mojo/edk/system/channel.h" | 16 #include "mojo/edk/system/channel.h" |
| 17 #include "mojo/edk/system/channel_endpoint.h" | 17 #include "mojo/edk/system/channel_endpoint.h" |
| 18 #include "mojo/edk/system/message_pipe_dispatcher.h" | 18 #include "mojo/edk/system/message_pipe_dispatcher.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 20 |
| 21 namespace mojo { | 21 namespace mojo { |
| 22 namespace system { | 22 namespace system { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 TEST_F(ChannelManagerTest, CallsFromOtherThread) { | 153 TEST_F(ChannelManagerTest, CallsFromOtherThread) { |
| 154 embedder::PlatformChannelPair channel_pair; | 154 embedder::PlatformChannelPair channel_pair; |
| 155 | 155 |
| 156 const ChannelId id = 1; | 156 const ChannelId id = 1; |
| 157 scoped_refptr<MessagePipeDispatcher> d = | 157 scoped_refptr<MessagePipeDispatcher> d = |
| 158 channel_manager().CreateChannelOnIOThread( | 158 channel_manager().CreateChannelOnIOThread( |
| 159 id, channel_pair.PassServerHandle()); | 159 id, channel_pair.PassServerHandle()); |
| 160 | 160 |
| 161 base::RunLoop run_loop; | 161 base::RunLoop run_loop; |
| 162 OtherThread thread(base::MessageLoopProxy::current(), &channel_manager(), id, | 162 OtherThread thread(base::ThreadTaskRunnerHandle::Get(), &channel_manager(), |
| 163 run_loop.QuitClosure()); | 163 id, run_loop.QuitClosure()); |
| 164 thread.Start(); | 164 thread.Start(); |
| 165 run_loop.Run(); | 165 run_loop.Run(); |
| 166 thread.Join(); | 166 thread.Join(); |
| 167 | 167 |
| 168 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); | 168 EXPECT_EQ(MOJO_RESULT_OK, d->Close()); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace | 171 } // namespace |
| 172 } // namespace system | 172 } // namespace system |
| 173 } // namespace mojo | 173 } // namespace mojo |
| OLD | NEW |