Chromium Code Reviews| Index: ui/compositor/test/fake_context_factory.cc |
| diff --git a/ui/compositor/test/fake_context_factory.cc b/ui/compositor/test/fake_context_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..79cf4e75a23276c85c55f3b46cc72dc64361822c |
| --- /dev/null |
| +++ b/ui/compositor/test/fake_context_factory.cc |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ui/compositor/test/fake_context_factory.h" |
| + |
| +#include "base/threading/thread_task_runner_handle.h" |
| +#include "cc/output/compositor_frame.h" |
| +#include "cc/output/compositor_frame_sink_client.h" |
| +#include "cc/scheduler/begin_frame_source.h" |
| +#include "cc/scheduler/delay_based_time_source.h" |
| +#include "cc/test/fake_compositor_frame_sink.h" |
| + |
| +namespace ui { |
| + |
| +const cc::CompositorFrame& FakeContextFactory::GetLastCompositorFrame() const { |
| + return *frame_sink_->last_sent_frame(); |
| +} |
| + |
| +void FakeContextFactory::CreateCompositorFrameSink( |
| + base::WeakPtr<ui::Compositor> compositor) { |
| + auto frame_sink = cc::FakeCompositorFrameSink::Create3d(); |
| + frame_sink_ = frame_sink.get(); |
| + compositor->SetCompositorFrameSink(std::move(frame_sink)); |
| +} |
| + |
| +scoped_refptr<cc::ContextProvider> |
| +FakeContextFactory::SharedMainThreadContextProvider() { |
| + return nullptr; |
| +} |
| + |
| +void FakeContextFactory::RemoveCompositor(ui::Compositor* compositor) { |
| + frame_sink_ = nullptr; |
| +} |
| + |
| +bool FakeContextFactory::DoesCreateTestContexts() { |
| + return true; |
| +} |
| + |
| +uint32_t FakeContextFactory::GetImageTextureTarget(gfx::BufferFormat format, |
| + gfx::BufferUsage usage) { |
| + return GL_TEXTURE_2D; |
| +} |
| + |
| +gpu::GpuMemoryBufferManager* FakeContextFactory::GetGpuMemoryBufferManager() { |
| + return &gpu_memory_buffer_manager_; |
| +} |
| + |
| +cc::TaskGraphRunner* FakeContextFactory::GetTaskGraphRunner() { |
| + return &task_graph_runner_; |
| +} |
| + |
| +void FakeContextFactory::AddObserver(ui::ContextFactoryObserver* observer) {} |
|
danakj
2017/03/17 16:54:31
(you can leave the defn of empty methods in the he
sadrul
2017/03/17 18:59:14
Done.
|
| +void FakeContextFactory::RemoveObserver(ui::ContextFactoryObserver* observer) {} |
| + |
| +} // namespace ui |