Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: cc/layers/ui_resource_layer_impl_unittest.cc

Issue 633773004: cc: Pass Occlusion instead of OcclusionTracker to LayerImpls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/ui_resource_layer_impl.cc ('k') | cc/layers/video_layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/append_quads_data.h" 5 #include "cc/layers/append_quads_data.h"
6 #include "cc/layers/ui_resource_layer_impl.h" 6 #include "cc/layers/ui_resource_layer_impl.h"
7 #include "cc/quads/draw_quad.h" 7 #include "cc/quads/draw_quad.h"
8 #include "cc/resources/ui_resource_bitmap.h" 8 #include "cc/resources/ui_resource_bitmap.h"
9 #include "cc/resources/ui_resource_client.h" 9 #include "cc/resources/ui_resource_client.h"
10 #include "cc/test/fake_impl_proxy.h" 10 #include "cc/test/fake_impl_proxy.h"
(...skipping 28 matching lines...) Expand all
39 UIResourceBitmap bitmap(bitmap_size, opaque); 39 UIResourceBitmap bitmap(bitmap_size, opaque);
40 40
41 host_impl->CreateUIResource(uid, bitmap); 41 host_impl->CreateUIResource(uid, bitmap);
42 layer->SetUIResourceId(uid); 42 layer->SetUIResourceId(uid);
43 43
44 return layer.Pass(); 44 return layer.Pass();
45 } 45 }
46 46
47 void QuadSizeTest(scoped_ptr<UIResourceLayerImpl> layer, 47 void QuadSizeTest(scoped_ptr<UIResourceLayerImpl> layer,
48 size_t expected_quad_size) { 48 size_t expected_quad_size) {
49 MockOcclusionTracker<LayerImpl> occlusion_tracker;
50 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 49 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
51 50
52 AppendQuadsData data; 51 AppendQuadsData data;
53 layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); 52 layer->AppendQuads(render_pass.get(), Occlusion(), &data);
54 53
55 // Verify quad rects 54 // Verify quad rects
56 const QuadList& quads = render_pass->quad_list; 55 const QuadList& quads = render_pass->quad_list;
57 EXPECT_EQ(expected_quad_size, quads.size()); 56 EXPECT_EQ(expected_quad_size, quads.size());
58 } 57 }
59 58
60 TEST(UIResourceLayerImplTest, VerifyDrawQuads) { 59 TEST(UIResourceLayerImplTest, VerifyDrawQuads) {
61 FakeImplProxy proxy; 60 FakeImplProxy proxy;
62 TestSharedBitmapManager shared_bitmap_manager; 61 TestSharedBitmapManager shared_bitmap_manager;
63 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 62 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
(...skipping 16 matching lines...) Expand all
80 layer = GenerateUIResourceLayer(&host_impl, 79 layer = GenerateUIResourceLayer(&host_impl,
81 bitmap_size, 80 bitmap_size,
82 layer_size, 81 layer_size,
83 opaque, 82 opaque,
84 uid); 83 uid);
85 QuadSizeTest(layer.Pass(), expected_quad_size); 84 QuadSizeTest(layer.Pass(), expected_quad_size);
86 } 85 }
87 86
88 void OpaqueBoundsTest(scoped_ptr<UIResourceLayerImpl> layer, 87 void OpaqueBoundsTest(scoped_ptr<UIResourceLayerImpl> layer,
89 const gfx::Rect& expected_opaque_bounds) { 88 const gfx::Rect& expected_opaque_bounds) {
90 MockOcclusionTracker<LayerImpl> occlusion_tracker;
91 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 89 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
92 90
93 AppendQuadsData data; 91 AppendQuadsData data;
94 layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); 92 layer->AppendQuads(render_pass.get(), Occlusion(), &data);
95 93
96 // Verify quad rects 94 // Verify quad rects
97 const QuadList& quads = render_pass->quad_list; 95 const QuadList& quads = render_pass->quad_list;
98 EXPECT_GE(quads.size(), (size_t)0); 96 EXPECT_GE(quads.size(), (size_t)0);
99 gfx::Rect opaque_rect = quads.front()->opaque_rect; 97 gfx::Rect opaque_rect = quads.front()->opaque_rect;
100 EXPECT_EQ(expected_opaque_bounds, opaque_rect); 98 EXPECT_EQ(expected_opaque_bounds, opaque_rect);
101 } 99 }
102 100
103 TEST(UIResourceLayerImplTest, VerifySetOpaqueOnSkBitmap) { 101 TEST(UIResourceLayerImplTest, VerifySetOpaqueOnSkBitmap) {
104 FakeImplProxy proxy; 102 FakeImplProxy proxy;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 LayerTestCommon::VerifyQuadsAreOccluded( 197 LayerTestCommon::VerifyQuadsAreOccluded(
200 impl.quad_list(), occluded, &partially_occluded_count); 198 impl.quad_list(), occluded, &partially_occluded_count);
201 // The layer outputs one quad, which is partially occluded. 199 // The layer outputs one quad, which is partially occluded.
202 EXPECT_EQ(1u, impl.quad_list().size()); 200 EXPECT_EQ(1u, impl.quad_list().size());
203 EXPECT_EQ(1u, partially_occluded_count); 201 EXPECT_EQ(1u, partially_occluded_count);
204 } 202 }
205 } 203 }
206 204
207 } // namespace 205 } // namespace
208 } // namespace cc 206 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/ui_resource_layer_impl.cc ('k') | cc/layers/video_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698