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

Side by Side Diff: content/browser/compositor/reflector_impl_unittest.cc

Issue 1821863002: Hook up ui::Compositor to Display's BeginFrameSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove OutputSurface::CommitVSyncParameters Created 4 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 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 "base/run_loop.h" 5 #include "base/run_loop.h"
6 #include "base/single_thread_task_runner.h" 6 #include "base/single_thread_task_runner.h"
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "cc/test/fake_output_surface_client.h" 8 #include "cc/test/fake_output_surface_client.h"
9 #include "cc/test/test_context_provider.h" 9 #include "cc/test/test_context_provider.h"
10 #include "cc/test/test_web_graphics_context_3d.h" 10 #include "cc/test/test_web_graphics_context_3d.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 new TestOverlayCandidatesOzone()))); 66 new TestOverlayCandidatesOzone())));
67 #else 67 #else
68 return nullptr; 68 return nullptr;
69 #endif // defined(USE_OZONE) 69 #endif // defined(USE_OZONE)
70 } 70 }
71 71
72 class TestOutputSurface : public BrowserCompositorOutputSurface { 72 class TestOutputSurface : public BrowserCompositorOutputSurface {
73 public: 73 public:
74 TestOutputSurface( 74 TestOutputSurface(
75 const scoped_refptr<cc::ContextProvider>& context_provider, 75 const scoped_refptr<cc::ContextProvider>& context_provider,
76 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager) 76 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
77 base::SingleThreadTaskRunner* task_runner)
77 : BrowserCompositorOutputSurface(context_provider, 78 : BrowserCompositorOutputSurface(context_provider,
78 nullptr, 79 nullptr,
79 vsync_manager, 80 vsync_manager,
81 task_runner,
80 CreateTestValidatorOzone()) { 82 CreateTestValidatorOzone()) {
81 surface_size_ = gfx::Size(256, 256); 83 surface_size_ = gfx::Size(256, 256);
82 device_scale_factor_ = 1.f; 84 device_scale_factor_ = 1.f;
83 } 85 }
84 86
85 void SetFlip(bool flip) { capabilities_.flipped_output_surface = flip; } 87 void SetFlip(bool flip) { capabilities_.flipped_output_surface = flip; }
86 88
87 void SwapBuffers(cc::CompositorFrame* frame) override {} 89 void SwapBuffers(cc::CompositorFrame* frame) override {}
88 90
89 void OnReflectorChanged() override { 91 void OnReflectorChanged() override {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 new NoTransportImageTransportFactory)); 129 new NoTransportImageTransportFactory));
128 message_loop_.reset(new base::MessageLoop()); 130 message_loop_.reset(new base::MessageLoop());
129 task_runner_ = message_loop_->task_runner(); 131 task_runner_ = message_loop_->task_runner();
130 compositor_task_runner_ = new FakeTaskRunner(); 132 compositor_task_runner_ = new FakeTaskRunner();
131 compositor_.reset( 133 compositor_.reset(
132 new ui::Compositor(context_factory, compositor_task_runner_.get())); 134 new ui::Compositor(context_factory, compositor_task_runner_.get()));
133 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); 135 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
134 context_provider_ = 136 context_provider_ =
135 cc::TestContextProvider::Create(cc::TestWebGraphicsContext3D::Create()); 137 cc::TestContextProvider::Create(cc::TestWebGraphicsContext3D::Create());
136 output_surface_ = scoped_ptr<TestOutputSurface>( 138 output_surface_ = scoped_ptr<TestOutputSurface>(
137 new TestOutputSurface(context_provider_, compositor_->vsync_manager())); 139 new TestOutputSurface(context_provider_, compositor_->vsync_manager(),
140 compositor_task_runner_.get()));
138 CHECK(output_surface_->BindToClient(&output_surface_client_)); 141 CHECK(output_surface_->BindToClient(&output_surface_client_));
139 142
140 root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); 143 root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
141 compositor_->SetRootLayer(root_layer_.get()); 144 compositor_->SetRootLayer(root_layer_.get());
142 mirroring_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); 145 mirroring_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
143 compositor_->root_layer()->Add(mirroring_layer_.get()); 146 compositor_->root_layer()->Add(mirroring_layer_.get());
144 gfx::Size size = output_surface_->SurfaceSize(); 147 gfx::Size size = output_surface_->SurfaceSize();
145 mirroring_layer_->SetBounds(gfx::Rect(size.width(), size.height())); 148 mirroring_layer_->SetBounds(gfx::Rect(size.width(), size.height()));
146 } 149 }
147 150
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 plane_2.plane_z_order = 1; 222 plane_2.plane_z_order = 1;
220 list.push_back(plane_1); 223 list.push_back(plane_1);
221 list.push_back(plane_2); 224 list.push_back(plane_2);
222 output_surface_->GetOverlayCandidateValidator()->CheckOverlaySupport(&list); 225 output_surface_->GetOverlayCandidateValidator()->CheckOverlaySupport(&list);
223 EXPECT_FALSE(list[0].overlay_handled); 226 EXPECT_FALSE(list[0].overlay_handled);
224 } 227 }
225 #endif // defined(USE_OZONE) 228 #endif // defined(USE_OZONE)
226 229
227 } // namespace 230 } // namespace
228 } // namespace content 231 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698