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
3 // found in the LICENSE file.
5 #include "base/memory/scoped_ptr.h"
6 #include "content/common/gpu/gpu_channel.h"
7 #include "content/common/gpu/gpu_channel_manager.h"
8 #include "testing/gtest/include/gtest/gtest.h"
11 class TestSimpleTaskRunner
;
20 class SyncPointManager
;
22 class TestGpuChannelManager
: public GpuChannelManager
{
24 TestGpuChannelManager(IPC::TestSink
* sink
,
25 base::SingleThreadTaskRunner
* task_runner
,
26 base::SingleThreadTaskRunner
* io_task_runner
,
27 gpu::SyncPointManager
* sync_point_manager
,
28 GpuMemoryBufferFactory
* gpu_memory_buffer_factory
);
29 ~TestGpuChannelManager() override
;
31 // IPC::Sender implementation.
32 bool Send(IPC::Message
* msg
) override
;
35 scoped_ptr
<GpuChannel
> CreateGpuChannel(
36 gfx::GLShareGroup
* share_group
,
37 gpu::gles2::MailboxManager
* mailbox_manager
,
39 uint64_t client_tracing_id
,
40 bool allow_future_sync_points
,
41 bool allow_real_time_streams
) override
;
44 IPC::TestSink
* const sink_
;
47 class TestGpuChannel
: public GpuChannel
{
49 TestGpuChannel(IPC::TestSink
* sink
,
50 GpuChannelManager
* gpu_channel_manager
,
51 gfx::GLShareGroup
* share_group
,
52 gpu::gles2::MailboxManager
* mailbox_manager
,
53 base::SingleThreadTaskRunner
* task_runner
,
54 base::SingleThreadTaskRunner
* io_task_runner
,
56 uint64_t client_tracing_id
,
57 bool allow_future_sync_points
,
58 bool allow_real_time_streams
);
59 ~TestGpuChannel() override
;
61 base::ProcessId
GetClientPID() const override
;
63 IPC::ChannelHandle
Init(base::WaitableEvent
* shutdown_event
) override
;
65 // IPC::Sender implementation.
66 bool Send(IPC::Message
* msg
) override
;
69 IPC::TestSink
* const sink_
;
72 class GpuChannelTestCommon
: public testing::Test
{
74 GpuChannelTestCommon();
75 ~GpuChannelTestCommon() override
;
78 IPC::TestSink
* sink() { return sink_
.get(); }
79 GpuChannelManager
* channel_manager() { return channel_manager_
.get(); }
80 base::TestSimpleTaskRunner
* task_runner() { return task_runner_
.get(); }
83 scoped_ptr
<IPC::TestSink
> sink_
;
84 scoped_refptr
<base::TestSimpleTaskRunner
> task_runner_
;
85 scoped_refptr
<base::TestSimpleTaskRunner
> io_task_runner_
;
86 scoped_ptr
<gpu::SyncPointManager
> sync_point_manager_
;
87 scoped_ptr
<GpuChannelManager
> channel_manager_
;
90 } // namespace content