| 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" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>( | 62 return scoped_ptr<BrowserCompositorOverlayCandidateValidator>( |
| 63 new BrowserCompositorOverlayCandidateValidatorOzone( | 63 new BrowserCompositorOverlayCandidateValidatorOzone( |
| 64 0, new TestOverlayCandidatesOzone())); | 64 0, new TestOverlayCandidatesOzone())); |
| 65 #else | 65 #else |
| 66 return nullptr; | 66 return nullptr; |
| 67 #endif // defined(USE_OZONE) | 67 #endif // defined(USE_OZONE) |
| 68 } | 68 } |
| 69 | 69 |
| 70 class TestOutputSurface : public BrowserCompositorOutputSurface { | 70 class TestOutputSurface : public BrowserCompositorOutputSurface { |
| 71 public: | 71 public: |
| 72 explicit TestOutputSurface( | 72 TestOutputSurface( |
| 73 const scoped_refptr<cc::ContextProvider>& context_provider) | 73 const scoped_refptr<cc::ContextProvider>& context_provider, |
| 74 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager) |
| 74 : BrowserCompositorOutputSurface(context_provider, | 75 : BrowserCompositorOutputSurface(context_provider, |
| 76 vsync_manager, |
| 75 CreateTestValidatorOzone().Pass()) {} | 77 CreateTestValidatorOzone().Pass()) {} |
| 76 | 78 |
| 77 void SetFlip(bool flip) { capabilities_.flipped_output_surface = flip; } | 79 void SetFlip(bool flip) { capabilities_.flipped_output_surface = flip; } |
| 78 | 80 |
| 79 void SwapBuffers(cc::CompositorFrame* frame) override {} | 81 void SwapBuffers(cc::CompositorFrame* frame) override {} |
| 80 | 82 |
| 81 #if defined(OS_MACOSX) | 83 #if defined(OS_MACOSX) |
| 82 void OnSurfaceDisplayed() override {} | 84 void OnSurfaceDisplayed() override {} |
| 83 void SetSurfaceSuspendedForRecycle(bool suspended) override {} | 85 void SetSurfaceSuspendedForRecycle(bool suspended) override {} |
| 84 bool SurfaceShouldNotShowFramesAfterSuspendForRecycle() const override { | 86 bool SurfaceShouldNotShowFramesAfterSuspendForRecycle() const override { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 104 new NoTransportImageTransportFactory)); | 106 new NoTransportImageTransportFactory)); |
| 105 message_loop_.reset(new base::MessageLoop()); | 107 message_loop_.reset(new base::MessageLoop()); |
| 106 proxy_ = message_loop_->message_loop_proxy(); | 108 proxy_ = message_loop_->message_loop_proxy(); |
| 107 compositor_task_runner_ = new FakeTaskRunner(); | 109 compositor_task_runner_ = new FakeTaskRunner(); |
| 108 compositor_.reset(new ui::Compositor(gfx::kNullAcceleratedWidget, | 110 compositor_.reset(new ui::Compositor(gfx::kNullAcceleratedWidget, |
| 109 context_factory, | 111 context_factory, |
| 110 compositor_task_runner_.get())); | 112 compositor_task_runner_.get())); |
| 111 context_provider_ = cc::TestContextProvider::Create( | 113 context_provider_ = cc::TestContextProvider::Create( |
| 112 cc::TestWebGraphicsContext3D::Create().Pass()); | 114 cc::TestWebGraphicsContext3D::Create().Pass()); |
| 113 output_surface_ = | 115 output_surface_ = |
| 114 scoped_ptr<TestOutputSurface>(new TestOutputSurface(context_provider_)); | 116 scoped_ptr<TestOutputSurface>( |
| 117 new TestOutputSurface(context_provider_, |
| 118 compositor_->vsync_manager())).Pass(); |
| 115 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 119 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 116 | 120 |
| 117 mirroring_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); | 121 mirroring_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); |
| 118 gfx::Size size = output_surface_->SurfaceSize(); | 122 gfx::Size size = output_surface_->SurfaceSize(); |
| 119 mirroring_layer_->SetBounds(gfx::Rect(size.width(), size.height())); | 123 mirroring_layer_->SetBounds(gfx::Rect(size.width(), size.height())); |
| 120 } | 124 } |
| 121 | 125 |
| 122 void SetUpReflector() { | 126 void SetUpReflector() { |
| 123 reflector_ = make_scoped_ptr( | 127 reflector_ = make_scoped_ptr( |
| 124 new ReflectorImpl(compositor_.get(), mirroring_layer_.get())); | 128 new ReflectorImpl(compositor_.get(), mirroring_layer_.get())); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 plane_2.plane_z_order = 1; | 194 plane_2.plane_z_order = 1; |
| 191 list.push_back(plane_1); | 195 list.push_back(plane_1); |
| 192 list.push_back(plane_2); | 196 list.push_back(plane_2); |
| 193 output_surface_->GetOverlayCandidateValidator()->CheckOverlaySupport(&list); | 197 output_surface_->GetOverlayCandidateValidator()->CheckOverlaySupport(&list); |
| 194 EXPECT_FALSE(list[0].overlay_handled); | 198 EXPECT_FALSE(list[0].overlay_handled); |
| 195 } | 199 } |
| 196 #endif // defined(USE_OZONE) | 200 #endif // defined(USE_OZONE) |
| 197 | 201 |
| 198 } // namespace | 202 } // namespace |
| 199 } // namespace content | 203 } // namespace content |
| OLD | NEW |