OLD | NEW |
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 : BrowserCompositorOutputSurface(context_provider, | 77 : BrowserCompositorOutputSurface(context_provider, |
78 nullptr, | 78 nullptr, |
79 vsync_manager, | 79 vsync_manager, |
80 CreateTestValidatorOzone().Pass()) { | 80 CreateTestValidatorOzone()) { |
81 surface_size_ = gfx::Size(256, 256); | 81 surface_size_ = gfx::Size(256, 256); |
82 device_scale_factor_ = 1.f; | 82 device_scale_factor_ = 1.f; |
83 } | 83 } |
84 | 84 |
85 void SetFlip(bool flip) { capabilities_.flipped_output_surface = flip; } | 85 void SetFlip(bool flip) { capabilities_.flipped_output_surface = flip; } |
86 | 86 |
87 void SwapBuffers(cc::CompositorFrame* frame) override {} | 87 void SwapBuffers(cc::CompositorFrame* frame) override {} |
88 | 88 |
89 void OnReflectorChanged() override { | 89 void OnReflectorChanged() override { |
90 if (!reflector_) { | 90 if (!reflector_) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 ui::InitializeContextFactoryForTests(enable_pixel_output); | 124 ui::InitializeContextFactoryForTests(enable_pixel_output); |
125 ImageTransportFactory::InitializeForUnitTests( | 125 ImageTransportFactory::InitializeForUnitTests( |
126 scoped_ptr<ImageTransportFactory>( | 126 scoped_ptr<ImageTransportFactory>( |
127 new NoTransportImageTransportFactory)); | 127 new NoTransportImageTransportFactory)); |
128 message_loop_.reset(new base::MessageLoop()); | 128 message_loop_.reset(new base::MessageLoop()); |
129 task_runner_ = message_loop_->task_runner(); | 129 task_runner_ = message_loop_->task_runner(); |
130 compositor_task_runner_ = new FakeTaskRunner(); | 130 compositor_task_runner_ = new FakeTaskRunner(); |
131 compositor_.reset( | 131 compositor_.reset( |
132 new ui::Compositor(context_factory, compositor_task_runner_.get())); | 132 new ui::Compositor(context_factory, compositor_task_runner_.get())); |
133 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); | 133 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); |
134 context_provider_ = cc::TestContextProvider::Create( | 134 context_provider_ = |
135 cc::TestWebGraphicsContext3D::Create().Pass()); | 135 cc::TestContextProvider::Create(cc::TestWebGraphicsContext3D::Create()); |
136 output_surface_ = | 136 output_surface_ = scoped_ptr<TestOutputSurface>( |
137 scoped_ptr<TestOutputSurface>( | 137 new TestOutputSurface(context_provider_, compositor_->vsync_manager())); |
138 new TestOutputSurface(context_provider_, | |
139 compositor_->vsync_manager())).Pass(); | |
140 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 138 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
141 | 139 |
142 root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); | 140 root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); |
143 compositor_->SetRootLayer(root_layer_.get()); | 141 compositor_->SetRootLayer(root_layer_.get()); |
144 mirroring_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); | 142 mirroring_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); |
145 compositor_->root_layer()->Add(mirroring_layer_.get()); | 143 compositor_->root_layer()->Add(mirroring_layer_.get()); |
146 gfx::Size size = output_surface_->SurfaceSize(); | 144 gfx::Size size = output_surface_->SurfaceSize(); |
147 mirroring_layer_->SetBounds(gfx::Rect(size.width(), size.height())); | 145 mirroring_layer_->SetBounds(gfx::Rect(size.width(), size.height())); |
148 } | 146 } |
149 | 147 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 plane_2.plane_z_order = 1; | 219 plane_2.plane_z_order = 1; |
222 list.push_back(plane_1); | 220 list.push_back(plane_1); |
223 list.push_back(plane_2); | 221 list.push_back(plane_2); |
224 output_surface_->GetOverlayCandidateValidator()->CheckOverlaySupport(&list); | 222 output_surface_->GetOverlayCandidateValidator()->CheckOverlaySupport(&list); |
225 EXPECT_FALSE(list[0].overlay_handled); | 223 EXPECT_FALSE(list[0].overlay_handled); |
226 } | 224 } |
227 #endif // defined(USE_OZONE) | 225 #endif // defined(USE_OZONE) |
228 | 226 |
229 } // namespace | 227 } // namespace |
230 } // namespace content | 228 } // namespace content |
OLD | NEW |