Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: ui/compositor/test/fake_context_factory.cc

Issue 2752303002: views/mus: Install a mus-friend ContextFactory for tests. (Closed)
Patch Set: . Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/compositor/test/fake_context_factory.h ('k') | ui/views/mus/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 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.
4
5 #include "ui/compositor/test/fake_context_factory.h"
6
7 #include "base/threading/thread_task_runner_handle.h"
8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/compositor_frame_sink_client.h"
10 #include "cc/scheduler/begin_frame_source.h"
11 #include "cc/scheduler/delay_based_time_source.h"
12 #include "cc/test/fake_compositor_frame_sink.h"
13
14 namespace ui {
15
16 const cc::CompositorFrame& FakeContextFactory::GetLastCompositorFrame() const {
17 return *frame_sink_->last_sent_frame();
18 }
19
20 void FakeContextFactory::CreateCompositorFrameSink(
21 base::WeakPtr<ui::Compositor> compositor) {
22 auto frame_sink = cc::FakeCompositorFrameSink::Create3d();
23 frame_sink_ = frame_sink.get();
24 compositor->SetCompositorFrameSink(std::move(frame_sink));
25 }
26
27 scoped_refptr<cc::ContextProvider>
28 FakeContextFactory::SharedMainThreadContextProvider() {
29 return nullptr;
30 }
31
32 void FakeContextFactory::RemoveCompositor(ui::Compositor* compositor) {
33 frame_sink_ = nullptr;
34 }
35
36 bool FakeContextFactory::DoesCreateTestContexts() {
37 return true;
38 }
39
40 uint32_t FakeContextFactory::GetImageTextureTarget(gfx::BufferFormat format,
41 gfx::BufferUsage usage) {
42 return GL_TEXTURE_2D;
43 }
44
45 gpu::GpuMemoryBufferManager* FakeContextFactory::GetGpuMemoryBufferManager() {
46 return &gpu_memory_buffer_manager_;
47 }
48
49 cc::TaskGraphRunner* FakeContextFactory::GetTaskGraphRunner() {
50 return &task_graph_runner_;
51 }
52
53 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/test/fake_context_factory.h ('k') | ui/views/mus/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698