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 "cc/output/context_provider.h" | 7 #include "cc/output/context_provider.h" |
8 #include "cc/output/output_surface.h" | 8 #include "cc/output/output_surface.h" |
9 #include "cc/test/layer_test_common.h" | 9 #include "cc/test/layer_test_common.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 namespace { | 13 namespace { |
14 | 14 |
15 void IgnoreCallback(uint32 sync_point, | 15 void IgnoreCallback(const gpu::SyncToken& sync_token, |
16 bool lost, | 16 bool lost, |
17 BlockingTaskRunner* main_thread_task_runner) { | 17 BlockingTaskRunner* main_thread_task_runner) {} |
18 } | |
19 | 18 |
20 TEST(TextureLayerImplTest, VisibleOpaqueRegion) { | 19 TEST(TextureLayerImplTest, VisibleOpaqueRegion) { |
21 const gfx::Size layer_bounds(100, 100); | 20 const gfx::Size layer_bounds(100, 100); |
22 const gfx::Rect layer_rect(layer_bounds); | 21 const gfx::Rect layer_rect(layer_bounds); |
23 const Region layer_region(layer_rect); | 22 const Region layer_region(layer_rect); |
24 | 23 |
25 LayerTestCommon::LayerImplTest impl; | 24 LayerTestCommon::LayerImplTest impl; |
26 | 25 |
27 TextureLayerImpl* layer = impl.AddChildToRoot<TextureLayerImpl>(); | 26 TextureLayerImpl* layer = impl.AddChildToRoot<TextureLayerImpl>(); |
28 layer->SetBounds(layer_bounds); | 27 layer->SetBounds(layer_bounds); |
(...skipping 16 matching lines...) Expand all Loading... |
45 | 44 |
46 TEST(TextureLayerImplTest, Occlusion) { | 45 TEST(TextureLayerImplTest, Occlusion) { |
47 gfx::Size layer_size(1000, 1000); | 46 gfx::Size layer_size(1000, 1000); |
48 gfx::Size viewport_size(1000, 1000); | 47 gfx::Size viewport_size(1000, 1000); |
49 | 48 |
50 LayerTestCommon::LayerImplTest impl; | 49 LayerTestCommon::LayerImplTest impl; |
51 | 50 |
52 gpu::Mailbox mailbox; | 51 gpu::Mailbox mailbox; |
53 impl.output_surface()->context_provider()->ContextGL()->GenMailboxCHROMIUM( | 52 impl.output_surface()->context_provider()->ContextGL()->GenMailboxCHROMIUM( |
54 mailbox.name); | 53 mailbox.name); |
55 TextureMailbox texture_mailbox(mailbox, GL_TEXTURE_2D, 0); | 54 TextureMailbox texture_mailbox(mailbox, gpu::SyncToken(), GL_TEXTURE_2D); |
56 | 55 |
57 TextureLayerImpl* texture_layer_impl = | 56 TextureLayerImpl* texture_layer_impl = |
58 impl.AddChildToRoot<TextureLayerImpl>(); | 57 impl.AddChildToRoot<TextureLayerImpl>(); |
59 texture_layer_impl->SetBounds(layer_size); | 58 texture_layer_impl->SetBounds(layer_size); |
60 texture_layer_impl->SetDrawsContent(true); | 59 texture_layer_impl->SetDrawsContent(true); |
61 texture_layer_impl->SetTextureMailbox( | 60 texture_layer_impl->SetTextureMailbox( |
62 texture_mailbox, | 61 texture_mailbox, |
63 SingleReleaseCallbackImpl::Create(base::Bind(&IgnoreCallback))); | 62 SingleReleaseCallbackImpl::Create(base::Bind(&IgnoreCallback))); |
64 | 63 |
65 impl.CalcDrawProps(viewport_size); | 64 impl.CalcDrawProps(viewport_size); |
(...skipping 26 matching lines...) Expand all Loading... |
92 LayerTestCommon::VerifyQuadsAreOccluded( | 91 LayerTestCommon::VerifyQuadsAreOccluded( |
93 impl.quad_list(), occluded, &partially_occluded_count); | 92 impl.quad_list(), occluded, &partially_occluded_count); |
94 // The layer outputs one quad, which is partially occluded. | 93 // The layer outputs one quad, which is partially occluded. |
95 EXPECT_EQ(1u, impl.quad_list().size()); | 94 EXPECT_EQ(1u, impl.quad_list().size()); |
96 EXPECT_EQ(1u, partially_occluded_count); | 95 EXPECT_EQ(1u, partially_occluded_count); |
97 } | 96 } |
98 } | 97 } |
99 | 98 |
100 } // namespace | 99 } // namespace |
101 } // namespace cc | 100 } // namespace cc |
OLD | NEW |