OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/layers/texture_layer_impl.h" | 5 #include "cc/layers/texture_layer_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "cc/output/compositor_frame_sink.h" | 9 #include "cc/output/compositor_frame_sink.h" |
10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
11 #include "cc/quads/draw_quad.h" | 11 #include "cc/quads/draw_quad.h" |
12 #include "cc/quads/texture_draw_quad.h" | 12 #include "cc/quads/texture_draw_quad.h" |
| 13 #include "cc/test/fake_compositor_frame_sink.h" |
13 #include "cc/test/layer_test_common.h" | 14 #include "cc/test/layer_test_common.h" |
14 #include "gpu/command_buffer/client/gles2_interface.h" | 15 #include "gpu/command_buffer/client/gles2_interface.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 | 17 |
17 namespace cc { | 18 namespace cc { |
18 namespace { | 19 namespace { |
19 | 20 |
20 void IgnoreCallback(const gpu::SyncToken& sync_token, | 21 void IgnoreCallback(const gpu::SyncToken& sync_token, |
21 bool lost, | 22 bool lost, |
22 BlockingTaskRunner* main_thread_task_runner) {} | 23 BlockingTaskRunner* main_thread_task_runner) {} |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 EXPECT_EQ(1u, impl.quad_list().size()); | 142 EXPECT_EQ(1u, impl.quad_list().size()); |
142 ASSERT_EQ(DrawQuad::Material::TEXTURE_CONTENT, | 143 ASSERT_EQ(DrawQuad::Material::TEXTURE_CONTENT, |
143 impl.quad_list().front()->material); | 144 impl.quad_list().front()->material); |
144 const TextureDrawQuad* quad = | 145 const TextureDrawQuad* quad = |
145 TextureDrawQuad::MaterialCast(impl.quad_list().front()); | 146 TextureDrawQuad::MaterialCast(impl.quad_list().front()); |
146 EXPECT_TRUE(quad->secure_output_only); | 147 EXPECT_TRUE(quad->secure_output_only); |
147 } | 148 } |
148 } | 149 } |
149 | 150 |
150 TEST(TextureLayerImplTest, ResourceNotFreedOnGpuRasterToggle) { | 151 TEST(TextureLayerImplTest, ResourceNotFreedOnGpuRasterToggle) { |
151 LayerTreeSettings settings; | |
152 settings.gpu_rasterization_enabled = true; | |
153 bool released = false; | 152 bool released = false; |
154 LayerTestCommon::LayerImplTest impl(settings); | 153 LayerTestCommon::LayerImplTest impl( |
| 154 FakeCompositorFrameSink::Create3dForGpuRasterization()); |
155 impl.host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 155 impl.host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
156 | 156 |
157 gfx::Size layer_size(1000, 1000); | 157 gfx::Size layer_size(1000, 1000); |
158 gfx::Size viewport_size(1000, 1000); | 158 gfx::Size viewport_size(1000, 1000); |
159 | 159 |
160 gpu::Mailbox mailbox; | 160 gpu::Mailbox mailbox; |
161 impl.compositor_frame_sink() | 161 impl.compositor_frame_sink() |
162 ->context_provider() | 162 ->context_provider() |
163 ->ContextGL() | 163 ->ContextGL() |
164 ->GenMailboxCHROMIUM(mailbox.name); | 164 ->GenMailboxCHROMIUM(mailbox.name); |
(...skipping 22 matching lines...) Expand all Loading... |
187 // Toggling the gpu rasterization clears all tilings on both trees. | 187 // Toggling the gpu rasterization clears all tilings on both trees. |
188 impl.host_impl()->SetHasGpuRasterizationTrigger(true); | 188 impl.host_impl()->SetHasGpuRasterizationTrigger(true); |
189 impl.host_impl()->SetContentIsSuitableForGpuRasterization(true); | 189 impl.host_impl()->SetContentIsSuitableForGpuRasterization(true); |
190 impl.host_impl()->CommitComplete(); | 190 impl.host_impl()->CommitComplete(); |
191 EXPECT_TRUE(impl.host_impl()->use_gpu_rasterization()); | 191 EXPECT_TRUE(impl.host_impl()->use_gpu_rasterization()); |
192 EXPECT_FALSE(released); | 192 EXPECT_FALSE(released); |
193 } | 193 } |
194 | 194 |
195 } // namespace | 195 } // namespace |
196 } // namespace cc | 196 } // namespace cc |
OLD | NEW |