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 "cc/test/fake_output_surface_client.h" | 7 #include "cc/test/fake_output_surface_client.h" |
8 #include "cc/test/test_context_provider.h" | 8 #include "cc/test/test_context_provider.h" |
9 #include "cc/test/test_web_graphics_context_3d.h" | 9 #include "cc/test/test_web_graphics_context_3d.h" |
10 #include "content/browser/compositor/browser_compositor_output_surface.h" | 10 #include "content/browser/compositor/browser_compositor_output_surface.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 | 70 |
71 class TestOutputSurface : public BrowserCompositorOutputSurface { | 71 class TestOutputSurface : public BrowserCompositorOutputSurface { |
72 public: | 72 public: |
73 TestOutputSurface( | 73 TestOutputSurface( |
74 const scoped_refptr<cc::ContextProvider>& context_provider, | 74 const scoped_refptr<cc::ContextProvider>& context_provider, |
75 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager) | 75 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager) |
76 : BrowserCompositorOutputSurface(context_provider, | 76 : BrowserCompositorOutputSurface(context_provider, |
77 nullptr, | 77 nullptr, |
78 vsync_manager, | 78 vsync_manager, |
79 CreateTestValidatorOzone().Pass()) {} | 79 CreateTestValidatorOzone().Pass()) { |
| 80 surface_size_ = gfx::Size(256, 256); |
| 81 device_scale_factor_ = 1.f; |
| 82 } |
80 | 83 |
81 void SetFlip(bool flip) { capabilities_.flipped_output_surface = flip; } | 84 void SetFlip(bool flip) { capabilities_.flipped_output_surface = flip; } |
82 | 85 |
83 void SwapBuffers(cc::CompositorFrame* frame) override {} | 86 void SwapBuffers(cc::CompositorFrame* frame) override {} |
84 | 87 |
85 void OnReflectorChanged() override { | 88 void OnReflectorChanged() override { |
86 if (!reflector_) { | 89 if (!reflector_) { |
87 reflector_texture_.reset(); | 90 reflector_texture_.reset(); |
88 } else { | 91 } else { |
89 reflector_texture_.reset(new ReflectorTexture(context_provider())); | 92 reflector_texture_.reset(new ReflectorTexture(context_provider())); |
90 reflector_->OnSourceTextureMailboxUpdated(reflector_texture_->mailbox()); | 93 reflector_->OnSourceTextureMailboxUpdated(reflector_texture_->mailbox()); |
91 } | 94 } |
92 } | 95 } |
93 | 96 |
94 #if defined(OS_MACOSX) | 97 #if defined(OS_MACOSX) |
95 void OnSurfaceDisplayed() override {} | 98 void OnSurfaceDisplayed() override {} |
96 void SetSurfaceSuspendedForRecycle(bool suspended) override {} | 99 void SetSurfaceSuspendedForRecycle(bool suspended) override {} |
97 bool SurfaceShouldNotShowFramesAfterSuspendForRecycle() const override { | 100 bool SurfaceShouldNotShowFramesAfterSuspendForRecycle() const override { |
98 return false; | 101 return false; |
99 } | 102 } |
100 #endif | 103 #endif |
101 | 104 |
102 gfx::Size SurfaceSize() const override { return gfx::Size(256, 256); } | |
103 | |
104 private: | 105 private: |
105 scoped_ptr<ReflectorTexture> reflector_texture_; | 106 scoped_ptr<ReflectorTexture> reflector_texture_; |
106 }; | 107 }; |
107 | 108 |
108 const gfx::Rect kSubRect(0, 0, 64, 64); | 109 const gfx::Rect kSubRect(0, 0, 64, 64); |
109 | 110 |
110 } // namespace | 111 } // namespace |
111 | 112 |
112 class ReflectorImplTest : public testing::Test { | 113 class ReflectorImplTest : public testing::Test { |
113 public: | 114 public: |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 plane_2.plane_z_order = 1; | 216 plane_2.plane_z_order = 1; |
216 list.push_back(plane_1); | 217 list.push_back(plane_1); |
217 list.push_back(plane_2); | 218 list.push_back(plane_2); |
218 output_surface_->GetOverlayCandidateValidator()->CheckOverlaySupport(&list); | 219 output_surface_->GetOverlayCandidateValidator()->CheckOverlaySupport(&list); |
219 EXPECT_FALSE(list[0].overlay_handled); | 220 EXPECT_FALSE(list[0].overlay_handled); |
220 } | 221 } |
221 #endif // defined(USE_OZONE) | 222 #endif // defined(USE_OZONE) |
222 | 223 |
223 } // namespace | 224 } // namespace |
224 } // namespace content | 225 } // namespace content |
OLD | NEW |