| 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/message_loop/message_loop.h" | |
| 6 #include "base/run_loop.h" | 5 #include "base/run_loop.h" |
| 7 #include "base/single_thread_task_runner.h" | 6 #include "base/single_thread_task_runner.h" |
| 8 #include "cc/test/fake_output_surface_client.h" | 7 #include "cc/test/fake_output_surface_client.h" |
| 9 #include "cc/test/test_context_provider.h" | 8 #include "cc/test/test_context_provider.h" |
| 10 #include "cc/test/test_web_graphics_context_3d.h" | 9 #include "cc/test/test_web_graphics_context_3d.h" |
| 11 #include "content/browser/compositor/browser_compositor_output_surface.h" | 10 #include "content/browser/compositor/browser_compositor_output_surface.h" |
| 12 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor.h" | 11 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor.h" |
| 13 #include "content/browser/compositor/reflector_impl.h" | 12 #include "content/browser/compositor/reflector_impl.h" |
| 14 #include "content/browser/compositor/reflector_texture.h" | 13 #include "content/browser/compositor/reflector_texture.h" |
| 15 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" | 14 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 class ReflectorImplTest : public testing::Test { | 110 class ReflectorImplTest : public testing::Test { |
| 112 public: | 111 public: |
| 113 void SetUp() override { | 112 void SetUp() override { |
| 114 bool enable_pixel_output = false; | 113 bool enable_pixel_output = false; |
| 115 ui::ContextFactory* context_factory = | 114 ui::ContextFactory* context_factory = |
| 116 ui::InitializeContextFactoryForTests(enable_pixel_output); | 115 ui::InitializeContextFactoryForTests(enable_pixel_output); |
| 117 ImageTransportFactory::InitializeForUnitTests( | 116 ImageTransportFactory::InitializeForUnitTests( |
| 118 scoped_ptr<ImageTransportFactory>( | 117 scoped_ptr<ImageTransportFactory>( |
| 119 new NoTransportImageTransportFactory)); | 118 new NoTransportImageTransportFactory)); |
| 120 message_loop_.reset(new base::MessageLoop()); | 119 message_loop_.reset(new base::MessageLoop()); |
| 121 proxy_ = message_loop_->message_loop_proxy(); | 120 task_runner_ = message_loop_->task_runner(); |
| 122 compositor_task_runner_ = new FakeTaskRunner(); | 121 compositor_task_runner_ = new FakeTaskRunner(); |
| 123 compositor_.reset(new ui::Compositor(gfx::kNullAcceleratedWidget, | 122 compositor_.reset(new ui::Compositor(gfx::kNullAcceleratedWidget, |
| 124 context_factory, | 123 context_factory, |
| 125 compositor_task_runner_.get())); | 124 compositor_task_runner_.get())); |
| 126 context_provider_ = cc::TestContextProvider::Create( | 125 context_provider_ = cc::TestContextProvider::Create( |
| 127 cc::TestWebGraphicsContext3D::Create().Pass()); | 126 cc::TestWebGraphicsContext3D::Create().Pass()); |
| 128 output_surface_ = | 127 output_surface_ = |
| 129 scoped_ptr<TestOutputSurface>( | 128 scoped_ptr<TestOutputSurface>( |
| 130 new TestOutputSurface(context_provider_, | 129 new TestOutputSurface(context_provider_, |
| 131 compositor_->vsync_manager())).Pass(); | 130 compositor_->vsync_manager())).Pass(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 158 ImageTransportFactory::Terminate(); | 157 ImageTransportFactory::Terminate(); |
| 159 } | 158 } |
| 160 | 159 |
| 161 void UpdateTexture() { reflector_->OnSourcePostSubBuffer(kSubRect); } | 160 void UpdateTexture() { reflector_->OnSourcePostSubBuffer(kSubRect); } |
| 162 | 161 |
| 163 protected: | 162 protected: |
| 164 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 163 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
| 165 scoped_refptr<cc::ContextProvider> context_provider_; | 164 scoped_refptr<cc::ContextProvider> context_provider_; |
| 166 cc::FakeOutputSurfaceClient output_surface_client_; | 165 cc::FakeOutputSurfaceClient output_surface_client_; |
| 167 scoped_ptr<base::MessageLoop> message_loop_; | 166 scoped_ptr<base::MessageLoop> message_loop_; |
| 168 scoped_refptr<base::MessageLoopProxy> proxy_; | 167 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 169 scoped_ptr<ui::Compositor> compositor_; | 168 scoped_ptr<ui::Compositor> compositor_; |
| 170 scoped_ptr<ui::Layer> root_layer_; | 169 scoped_ptr<ui::Layer> root_layer_; |
| 171 scoped_ptr<ui::Layer> mirroring_layer_; | 170 scoped_ptr<ui::Layer> mirroring_layer_; |
| 172 scoped_ptr<ReflectorImpl> reflector_; | 171 scoped_ptr<ReflectorImpl> reflector_; |
| 173 scoped_ptr<TestOutputSurface> output_surface_; | 172 scoped_ptr<TestOutputSurface> output_surface_; |
| 174 }; | 173 }; |
| 175 | 174 |
| 176 namespace { | 175 namespace { |
| 177 TEST_F(ReflectorImplTest, CheckNormalOutputSurface) { | 176 TEST_F(ReflectorImplTest, CheckNormalOutputSurface) { |
| 178 output_surface_->SetFlip(false); | 177 output_surface_->SetFlip(false); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 plane_2.plane_z_order = 1; | 212 plane_2.plane_z_order = 1; |
| 214 list.push_back(plane_1); | 213 list.push_back(plane_1); |
| 215 list.push_back(plane_2); | 214 list.push_back(plane_2); |
| 216 output_surface_->GetOverlayCandidateValidator()->CheckOverlaySupport(&list); | 215 output_surface_->GetOverlayCandidateValidator()->CheckOverlaySupport(&list); |
| 217 EXPECT_FALSE(list[0].overlay_handled); | 216 EXPECT_FALSE(list[0].overlay_handled); |
| 218 } | 217 } |
| 219 #endif // defined(USE_OZONE) | 218 #endif // defined(USE_OZONE) |
| 220 | 219 |
| 221 } // namespace | 220 } // namespace |
| 222 } // namespace content | 221 } // namespace content |
| OLD | NEW |