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

Side by Side Diff: cc/layers/picture_image_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: 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
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/picture_image_layer_impl.h" 5 #include "cc/layers/picture_image_layer_impl.h"
6 6
7 #include "cc/layers/append_quads_data.h" 7 #include "cc/layers/append_quads_data.h"
8 #include "cc/quads/draw_quad.h" 8 #include "cc/quads/draw_quad.h"
9 #include "cc/resources/tile_priority.h" 9 #include "cc/resources/tile_priority.h"
10 #include "cc/test/fake_impl_proxy.h" 10 #include "cc/test/fake_impl_proxy.h"
11 #include "cc/test/fake_layer_tree_host_impl.h" 11 #include "cc/test/fake_layer_tree_host_impl.h"
12 #include "cc/test/fake_output_surface.h" 12 #include "cc/test/fake_output_surface.h"
13 #include "cc/test/fake_picture_layer_tiling_client.h" 13 #include "cc/test/fake_picture_layer_tiling_client.h"
14 #include "cc/test/impl_side_painting_settings.h" 14 #include "cc/test/impl_side_painting_settings.h"
15 #include "cc/test/mock_occlusion_tracker.h"
16 #include "cc/test/test_shared_bitmap_manager.h" 15 #include "cc/test/test_shared_bitmap_manager.h"
17 #include "cc/trees/layer_tree_impl.h" 16 #include "cc/trees/layer_tree_impl.h"
18 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
19 18
20 namespace cc { 19 namespace cc {
21 namespace { 20 namespace {
22 21
23 class TestablePictureImageLayerImpl : public PictureImageLayerImpl { 22 class TestablePictureImageLayerImpl : public PictureImageLayerImpl {
24 public: 23 public:
25 TestablePictureImageLayerImpl(LayerTreeImpl* tree_impl, int id) 24 TestablePictureImageLayerImpl(LayerTreeImpl* tree_impl, int id)
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 EXPECT_EQ(1.f, active_layer->tilings()->tiling_at(0)->contents_scale()); 139 EXPECT_EQ(1.f, active_layer->tilings()->tiling_at(0)->contents_scale());
141 140
142 // Create tile and resource. 141 // Create tile and resource.
143 active_layer->tilings()->tiling_at(0)->CreateAllTilesForTesting(); 142 active_layer->tilings()->tiling_at(0)->CreateAllTilesForTesting();
144 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( 143 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(
145 active_layer->tilings()->tiling_at(0)->AllTilesForTesting()); 144 active_layer->tilings()->tiling_at(0)->AllTilesForTesting());
146 145
147 // Draw. 146 // Draw.
148 active_layer->draw_properties().visible_content_rect = 147 active_layer->draw_properties().visible_content_rect =
149 gfx::Rect(active_layer->bounds()); 148 gfx::Rect(active_layer->bounds());
150 MockOcclusionTracker<LayerImpl> occlusion_tracker;
151 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 149 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
152 AppendQuadsData data; 150 AppendQuadsData data;
153 active_layer->WillDraw(DRAW_MODE_SOFTWARE, NULL); 151 active_layer->WillDraw(DRAW_MODE_SOFTWARE, NULL);
154 active_layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); 152 active_layer->AppendQuads(render_pass.get(), Occlusion(), &data);
155 active_layer->DidDraw(NULL); 153 active_layer->DidDraw(NULL);
156 154
157 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material); 155 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material);
158 156
159 // Tiles are ready at correct scale, so should not set had_incomplete_tile. 157 // Tiles are ready at correct scale, so should not set had_incomplete_tile.
160 EXPECT_EQ(0, data.num_incomplete_tiles); 158 EXPECT_EQ(0, data.num_incomplete_tiles);
161 } 159 }
162 160
163 } // namespace 161 } // namespace
164 } // namespace cc 162 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698