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/context_provider.h" | 10 #include "cc/output/context_provider.h" |
10 #include "cc/output/output_surface.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/layer_test_common.h" | 13 #include "cc/test/layer_test_common.h" |
14 #include "gpu/command_buffer/client/gles2_interface.h" | 14 #include "gpu/command_buffer/client/gles2_interface.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 namespace cc { | 17 namespace cc { |
18 namespace { | 18 namespace { |
19 | 19 |
20 void IgnoreCallback(const gpu::SyncToken& sync_token, | 20 void IgnoreCallback(const gpu::SyncToken& sync_token, |
(...skipping 26 matching lines...) Expand all Loading... |
47 EXPECT_EQ(Region().ToString(), layer->VisibleOpaqueRegion().ToString()); | 47 EXPECT_EQ(Region().ToString(), layer->VisibleOpaqueRegion().ToString()); |
48 } | 48 } |
49 | 49 |
50 TEST(TextureLayerImplTest, Occlusion) { | 50 TEST(TextureLayerImplTest, Occlusion) { |
51 gfx::Size layer_size(1000, 1000); | 51 gfx::Size layer_size(1000, 1000); |
52 gfx::Size viewport_size(1000, 1000); | 52 gfx::Size viewport_size(1000, 1000); |
53 | 53 |
54 LayerTestCommon::LayerImplTest impl; | 54 LayerTestCommon::LayerImplTest impl; |
55 | 55 |
56 gpu::Mailbox mailbox; | 56 gpu::Mailbox mailbox; |
57 impl.output_surface()->context_provider()->ContextGL()->GenMailboxCHROMIUM( | 57 impl.compositor_frame_sink() |
58 mailbox.name); | 58 ->context_provider() |
| 59 ->ContextGL() |
| 60 ->GenMailboxCHROMIUM(mailbox.name); |
59 TextureMailbox texture_mailbox( | 61 TextureMailbox texture_mailbox( |
60 mailbox, | 62 mailbox, |
61 gpu::SyncToken(gpu::CommandBufferNamespace::GPU_IO, 0x123, | 63 gpu::SyncToken(gpu::CommandBufferNamespace::GPU_IO, 0x123, |
62 gpu::CommandBufferId::FromUnsafeValue(0x234), 0x456), | 64 gpu::CommandBufferId::FromUnsafeValue(0x234), 0x456), |
63 GL_TEXTURE_2D); | 65 GL_TEXTURE_2D); |
64 | 66 |
65 TextureLayerImpl* texture_layer_impl = | 67 TextureLayerImpl* texture_layer_impl = |
66 impl.AddChildToRoot<TextureLayerImpl>(); | 68 impl.AddChildToRoot<TextureLayerImpl>(); |
67 texture_layer_impl->SetBounds(layer_size); | 69 texture_layer_impl->SetBounds(layer_size); |
68 texture_layer_impl->SetDrawsContent(true); | 70 texture_layer_impl->SetDrawsContent(true); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 107 } |
106 } | 108 } |
107 | 109 |
108 TEST(TextureLayerImplTest, OutputIsSecure) { | 110 TEST(TextureLayerImplTest, OutputIsSecure) { |
109 gfx::Size layer_size(1000, 1000); | 111 gfx::Size layer_size(1000, 1000); |
110 gfx::Size viewport_size(1000, 1000); | 112 gfx::Size viewport_size(1000, 1000); |
111 | 113 |
112 LayerTestCommon::LayerImplTest impl; | 114 LayerTestCommon::LayerImplTest impl; |
113 | 115 |
114 gpu::Mailbox mailbox; | 116 gpu::Mailbox mailbox; |
115 impl.output_surface()->context_provider()->ContextGL()->GenMailboxCHROMIUM( | 117 impl.compositor_frame_sink() |
116 mailbox.name); | 118 ->context_provider() |
| 119 ->ContextGL() |
| 120 ->GenMailboxCHROMIUM(mailbox.name); |
117 TextureMailbox texture_mailbox( | 121 TextureMailbox texture_mailbox( |
118 mailbox, | 122 mailbox, |
119 gpu::SyncToken(gpu::CommandBufferNamespace::GPU_IO, 0x123, | 123 gpu::SyncToken(gpu::CommandBufferNamespace::GPU_IO, 0x123, |
120 gpu::CommandBufferId::FromUnsafeValue(0x234), 0x456), | 124 gpu::CommandBufferId::FromUnsafeValue(0x234), 0x456), |
121 GL_TEXTURE_2D, layer_size, false, true); | 125 GL_TEXTURE_2D, layer_size, false, true); |
122 | 126 |
123 TextureLayerImpl* texture_layer_impl = | 127 TextureLayerImpl* texture_layer_impl = |
124 impl.AddChildToRoot<TextureLayerImpl>(); | 128 impl.AddChildToRoot<TextureLayerImpl>(); |
125 texture_layer_impl->SetBounds(layer_size); | 129 texture_layer_impl->SetBounds(layer_size); |
126 texture_layer_impl->SetDrawsContent(true); | 130 texture_layer_impl->SetDrawsContent(true); |
(...skipping 11 matching lines...) Expand all Loading... |
138 ASSERT_EQ(DrawQuad::Material::TEXTURE_CONTENT, | 142 ASSERT_EQ(DrawQuad::Material::TEXTURE_CONTENT, |
139 impl.quad_list().front()->material); | 143 impl.quad_list().front()->material); |
140 const TextureDrawQuad* quad = | 144 const TextureDrawQuad* quad = |
141 TextureDrawQuad::MaterialCast(impl.quad_list().front()); | 145 TextureDrawQuad::MaterialCast(impl.quad_list().front()); |
142 EXPECT_TRUE(quad->secure_output_only); | 146 EXPECT_TRUE(quad->secure_output_only); |
143 } | 147 } |
144 } | 148 } |
145 | 149 |
146 } // namespace | 150 } // namespace |
147 } // namespace cc | 151 } // namespace cc |
OLD | NEW |