| 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 "content/common/gpu/gpu_channel_test_common.h" | 5 #include "content/common/gpu/gpu_channel_test_common.h" |
| 6 | 6 |
| 7 #include "base/test/test_simple_task_runner.h" | 7 #include "base/test/test_simple_task_runner.h" |
| 8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "gpu/command_buffer/service/sync_point_manager.h" | 9 #include "gpu/command_buffer/service/sync_point_manager.h" |
| 10 #include "ipc/ipc_test_sink.h" | 10 #include "ipc/ipc_test_sink.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 TestGpuChannelManagerDelegate::TestGpuChannelManagerDelegate() {} |
| 15 |
| 16 TestGpuChannelManagerDelegate::~TestGpuChannelManagerDelegate() {} |
| 17 |
| 18 void TestGpuChannelManagerDelegate::SetActiveURL(const std::string& url) {} |
| 19 |
| 14 TestGpuChannelManager::TestGpuChannelManager( | 20 TestGpuChannelManager::TestGpuChannelManager( |
| 15 IPC::TestSink* sink, | 21 IPC::TestSink* sink, |
| 22 GpuChannelManagerDelegate* delegate, |
| 16 base::SingleThreadTaskRunner* task_runner, | 23 base::SingleThreadTaskRunner* task_runner, |
| 17 base::SingleThreadTaskRunner* io_task_runner, | 24 base::SingleThreadTaskRunner* io_task_runner, |
| 18 gpu::SyncPointManager* sync_point_manager, | 25 gpu::SyncPointManager* sync_point_manager, |
| 19 GpuMemoryBufferFactory* gpu_memory_buffer_factory) | 26 GpuMemoryBufferFactory* gpu_memory_buffer_factory) |
| 20 : GpuChannelManager(nullptr, | 27 : GpuChannelManager(delegate, |
| 28 nullptr, |
| 21 nullptr, | 29 nullptr, |
| 22 task_runner, | 30 task_runner, |
| 23 io_task_runner, | 31 io_task_runner, |
| 24 nullptr, | 32 nullptr, |
| 25 sync_point_manager, | 33 sync_point_manager, |
| 26 gpu_memory_buffer_factory), | 34 gpu_memory_buffer_factory), |
| 27 sink_(sink) {} | 35 sink_(sink) {} |
| 28 | 36 |
| 29 TestGpuChannelManager::~TestGpuChannelManager() { | 37 TestGpuChannelManager::~TestGpuChannelManager() { |
| 30 // Clear gpu channels here so that any IPC messages sent are handled using the | 38 // Clear gpu channels here so that any IPC messages sent are handled using the |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 filter_->OnFilterAdded(sink_); | 97 filter_->OnFilterAdded(sink_); |
| 90 return IPC::ChannelHandle(channel_id()); | 98 return IPC::ChannelHandle(channel_id()); |
| 91 } | 99 } |
| 92 | 100 |
| 93 bool TestGpuChannel::Send(IPC::Message* msg) { | 101 bool TestGpuChannel::Send(IPC::Message* msg) { |
| 94 DCHECK(!msg->is_sync()); | 102 DCHECK(!msg->is_sync()); |
| 95 return sink_->Send(msg); | 103 return sink_->Send(msg); |
| 96 } | 104 } |
| 97 | 105 |
| 98 // TODO(sunnyps): Use a mock memory buffer factory when necessary. | 106 // TODO(sunnyps): Use a mock memory buffer factory when necessary. |
| 107 |
| 99 GpuChannelTestCommon::GpuChannelTestCommon() | 108 GpuChannelTestCommon::GpuChannelTestCommon() |
| 100 : sink_(new IPC::TestSink), | 109 : sink_(new IPC::TestSink), |
| 101 task_runner_(new base::TestSimpleTaskRunner), | 110 task_runner_(new base::TestSimpleTaskRunner), |
| 102 io_task_runner_(new base::TestSimpleTaskRunner), | 111 io_task_runner_(new base::TestSimpleTaskRunner), |
| 103 sync_point_manager_(new gpu::SyncPointManager(false)), | 112 sync_point_manager_(new gpu::SyncPointManager(false)), |
| 104 channel_manager_(new TestGpuChannelManager(sink_.get(), | 113 channel_manager_delegate_(new TestGpuChannelManagerDelegate()), |
| 105 task_runner_.get(), | 114 channel_manager_( |
| 106 io_task_runner_.get(), | 115 new TestGpuChannelManager(sink_.get(), |
| 107 sync_point_manager_.get(), | 116 channel_manager_delegate_.get(), |
| 108 nullptr)) {} | 117 task_runner_.get(), |
| 118 io_task_runner_.get(), |
| 119 sync_point_manager_.get(), |
| 120 nullptr)) {} |
| 109 | 121 |
| 110 GpuChannelTestCommon::~GpuChannelTestCommon() {} | 122 GpuChannelTestCommon::~GpuChannelTestCommon() {} |
| 111 | 123 |
| 112 } // namespace content | 124 } // namespace content |
| OLD | NEW |