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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 bool TestGpuChannel::Send(IPC::Message* msg) { | 126 bool TestGpuChannel::Send(IPC::Message* msg) { |
127 DCHECK(!msg->is_sync()); | 127 DCHECK(!msg->is_sync()); |
128 return sink_.Send(msg); | 128 return sink_.Send(msg); |
129 } | 129 } |
130 | 130 |
131 // TODO(sunnyps): Use a mock memory buffer factory when necessary. | 131 // TODO(sunnyps): Use a mock memory buffer factory when necessary. |
132 GpuChannelTestCommon::GpuChannelTestCommon() | 132 GpuChannelTestCommon::GpuChannelTestCommon() |
133 : task_runner_(new base::TestSimpleTaskRunner), | 133 : task_runner_(new base::TestSimpleTaskRunner), |
134 io_task_runner_(new base::TestSimpleTaskRunner), | 134 io_task_runner_(new base::TestSimpleTaskRunner), |
135 sync_point_manager_(new SyncPointManager(false)), | 135 sync_point_manager_(new SyncPointManager()), |
136 channel_manager_delegate_(new TestGpuChannelManagerDelegate()) {} | 136 channel_manager_delegate_(new TestGpuChannelManagerDelegate()) {} |
137 | 137 |
138 GpuChannelTestCommon::~GpuChannelTestCommon() { | 138 GpuChannelTestCommon::~GpuChannelTestCommon() { |
139 // Clear pending tasks to avoid refptr cycles that get flagged by ASAN. | 139 // Clear pending tasks to avoid refptr cycles that get flagged by ASAN. |
140 task_runner_->ClearPendingTasks(); | 140 task_runner_->ClearPendingTasks(); |
141 io_task_runner_->ClearPendingTasks(); | 141 io_task_runner_->ClearPendingTasks(); |
142 } | 142 } |
143 | 143 |
144 void GpuChannelTestCommon::SetUp() { | 144 void GpuChannelTestCommon::SetUp() { |
145 channel_manager_.reset(new TestGpuChannelManager( | 145 channel_manager_.reset(new TestGpuChannelManager( |
146 gpu_preferences_, channel_manager_delegate_.get(), task_runner_.get(), | 146 gpu_preferences_, channel_manager_delegate_.get(), task_runner_.get(), |
147 io_task_runner_.get(), sync_point_manager_.get(), nullptr)); | 147 io_task_runner_.get(), sync_point_manager_.get(), nullptr)); |
148 } | 148 } |
149 | 149 |
150 void GpuChannelTestCommon::TearDown() { | 150 void GpuChannelTestCommon::TearDown() { |
151 // Destroying channels causes tasks to run on the IO task runner. | 151 // Destroying channels causes tasks to run on the IO task runner. |
152 channel_manager_ = nullptr; | 152 channel_manager_ = nullptr; |
153 } | 153 } |
154 | 154 |
155 | 155 |
156 } // namespace gpu | 156 } // namespace gpu |
OLD | NEW |