| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "gpu/ipc/service/gpu_channel_test_common.h" | 5 #include "gpu/ipc/service/gpu_channel_test_common.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/test/test_simple_task_runner.h" | 8 #include "base/test/test_simple_task_runner.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "gpu/command_buffer/service/sync_point_manager.h" | 10 #include "gpu/command_buffer/service/sync_point_manager.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // Call stubs here so that any IPC messages sent are handled using the | 110 // Call stubs here so that any IPC messages sent are handled using the |
| 111 // overridden Send method. | 111 // overridden Send method. |
| 112 stubs_.clear(); | 112 stubs_.clear(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 base::ProcessId TestGpuChannel::GetClientPID() const { | 115 base::ProcessId TestGpuChannel::GetClientPID() const { |
| 116 return base::kNullProcessId; | 116 return base::kNullProcessId; |
| 117 } | 117 } |
| 118 | 118 |
| 119 IPC::ChannelHandle TestGpuChannel::Init(base::WaitableEvent* shutdown_event) { | 119 IPC::ChannelHandle TestGpuChannel::Init(base::WaitableEvent* shutdown_event) { |
| 120 channel_id_ = "ChannelMojo-gpu"; | |
| 121 filter_->OnFilterAdded(&sink_); | 120 filter_->OnFilterAdded(&sink_); |
| 122 return IPC::ChannelHandle(channel_id()); | 121 mojo::MessagePipe pipe; |
| 122 return pipe.handle0.release(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 bool TestGpuChannel::Send(IPC::Message* msg) { | 125 bool TestGpuChannel::Send(IPC::Message* msg) { |
| 126 DCHECK(!msg->is_sync()); | 126 DCHECK(!msg->is_sync()); |
| 127 return sink_.Send(msg); | 127 return sink_.Send(msg); |
| 128 } | 128 } |
| 129 | 129 |
| 130 // TODO(sunnyps): Use a mock memory buffer factory when necessary. | 130 // TODO(sunnyps): Use a mock memory buffer factory when necessary. |
| 131 GpuChannelTestCommon::GpuChannelTestCommon() | 131 GpuChannelTestCommon::GpuChannelTestCommon() |
| 132 : task_runner_(new base::TestSimpleTaskRunner), | 132 : task_runner_(new base::TestSimpleTaskRunner), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 146 io_task_runner_.get(), sync_point_manager_.get(), nullptr)); | 146 io_task_runner_.get(), sync_point_manager_.get(), nullptr)); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void GpuChannelTestCommon::TearDown() { | 149 void GpuChannelTestCommon::TearDown() { |
| 150 // Destroying channels causes tasks to run on the IO task runner. | 150 // Destroying channels causes tasks to run on the IO task runner. |
| 151 channel_manager_ = nullptr; | 151 channel_manager_ = nullptr; |
| 152 } | 152 } |
| 153 | 153 |
| 154 | 154 |
| 155 } // namespace gpu | 155 } // namespace gpu |
| OLD | NEW |