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

Side by Side Diff: cc/trees/layer_tree_host_unittest_damage.cc

Issue 14925009: Run all LayerTreeHost tests with a delegating renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: uber-unittests: for landing2 Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "cc/test/fake_content_layer.h" 7 #include "cc/test/fake_content_layer.h"
8 #include "cc/test/fake_content_layer_client.h" 8 #include "cc/test/fake_content_layer_client.h"
9 #include "cc/test/layer_tree_test.h" 9 #include "cc/test/layer_tree_test.h"
10 #include "cc/trees/damage_tracker.h" 10 #include "cc/trees/damage_tracker.h"
(...skipping 13 matching lines...) Expand all
24 did_swap_and_succeed_ = 0; 24 did_swap_and_succeed_ = 0;
25 PostSetNeedsCommitToMainThread(); 25 PostSetNeedsCommitToMainThread();
26 } 26 }
27 27
28 virtual void SetupTree() OVERRIDE { 28 virtual void SetupTree() OVERRIDE {
29 scoped_refptr<FakeContentLayer> root = FakeContentLayer::Create(&client_); 29 scoped_refptr<FakeContentLayer> root = FakeContentLayer::Create(&client_);
30 root->SetBounds(gfx::Size(10, 10)); 30 root->SetBounds(gfx::Size(10, 10));
31 31
32 // Most of the layer isn't visible. 32 // Most of the layer isn't visible.
33 content_ = FakeContentLayer::Create(&client_); 33 content_ = FakeContentLayer::Create(&client_);
34 content_->SetBounds(gfx::Size(100, 100)); 34 content_->SetBounds(gfx::Size(2000, 100));
35 root->AddChild(content_); 35 root->AddChild(content_);
36 36
37 layer_tree_host()->SetRootLayer(root); 37 layer_tree_host()->SetRootLayer(root);
38 LayerTreeHostDamageTest::SetupTree(); 38 LayerTreeHostDamageTest::SetupTree();
39 } 39 }
40 40
41 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 41 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
42 LayerTreeHostImpl::FrameData* frame_data, 42 LayerTreeHostImpl::FrameData* frame_data,
43 bool result) OVERRIDE { 43 bool result) OVERRIDE {
44 EXPECT_TRUE(result); 44 EXPECT_TRUE(result);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 case 1: 79 case 1:
80 layer_tree_host()->SetNeedsCommit(); 80 layer_tree_host()->SetNeedsCommit();
81 break; 81 break;
82 case 2: 82 case 2:
83 // Cause visible damage. 83 // Cause visible damage.
84 content_->SetNeedsDisplayRect( 84 content_->SetNeedsDisplayRect(
85 gfx::Rect(layer_tree_host()->device_viewport_size())); 85 gfx::Rect(layer_tree_host()->device_viewport_size()));
86 break; 86 break;
87 case 3: 87 case 3:
88 // Cause non-visible damage. 88 // Cause non-visible damage.
89 content_->SetNeedsDisplayRect(gfx::Rect(90, 90, 10, 10)); 89 content_->SetNeedsDisplayRect(gfx::Rect(1990, 1990, 10, 10));
90 break; 90 break;
91 } 91 }
92 } 92 }
93 93
94 virtual void AfterTest() OVERRIDE { 94 virtual void AfterTest() OVERRIDE {
95 EXPECT_EQ(4, did_swaps_); 95 EXPECT_EQ(4, did_swaps_);
96 EXPECT_EQ(2, expect_swap_and_succeed_); 96 EXPECT_EQ(2, expect_swap_and_succeed_);
97 EXPECT_EQ(expect_swap_and_succeed_, did_swap_and_succeed_); 97 EXPECT_EQ(expect_swap_and_succeed_, did_swap_and_succeed_);
98 } 98 }
99 99
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 case 2: 222 case 2:
223 // The whole frame should be damaged as requested. 223 // The whole frame should be damaged as requested.
224 EXPECT_EQ(gfx::RectF(root_surface->content_rect()).ToString(), 224 EXPECT_EQ(gfx::RectF(root_surface->content_rect()).ToString(),
225 root_damage.ToString()); 225 root_damage.ToString());
226 EXPECT_FALSE(frame_data->has_no_damage); 226 EXPECT_FALSE(frame_data->has_no_damage);
227 227
228 // Just a part of the next frame should be damaged. 228 // Just a part of the next frame should be damaged.
229 child_damage_rect_ = gfx::RectF(10, 11, 12, 13); 229 child_damage_rect_ = gfx::RectF(10, 11, 12, 13);
230 break; 230 break;
231 case 3: 231 case 3:
232 // The update rect in the child should be damaged. 232 if (!delegating_renderer()) {
233 EXPECT_EQ(gfx::RectF(100+10, 100+11, 12, 13).ToString(), 233 // The update rect in the child should be damaged.
234 root_damage.ToString()); 234 EXPECT_EQ(gfx::RectF(100+10, 100+11, 12, 13).ToString(),
235 root_damage.ToString());
236 } else {
237 // When using a delegating renderer, the entire child is considered
238 // damaged as we need to replace its resources with newly created
239 // ones.
240 EXPECT_EQ(gfx::RectF(child_->position(), child_->bounds()).ToString(),
241 root_damage.ToString());
242 }
235 EXPECT_FALSE(frame_data->has_no_damage); 243 EXPECT_FALSE(frame_data->has_no_damage);
236 244
237 // If we damage part of the frame, but also damage the full 245 // If we damage part of the frame, but also damage the full
238 // frame, then the whole frame should be damaged. 246 // frame, then the whole frame should be damaged.
239 child_damage_rect_ = gfx::RectF(10, 11, 12, 13); 247 child_damage_rect_ = gfx::RectF(10, 11, 12, 13);
240 host_impl->SetFullRootLayerDamage(); 248 host_impl->SetFullRootLayerDamage();
241 break; 249 break;
242 case 4: 250 case 4:
243 // The whole frame is damaged. 251 // The whole frame is damaged.
244 EXPECT_EQ(gfx::RectF(root_surface->content_rect()).ToString(), 252 EXPECT_EQ(gfx::RectF(root_surface->content_rect()).ToString(),
(...skipping 21 matching lines...) Expand all
266 FakeContentLayerClient client_; 274 FakeContentLayerClient client_;
267 scoped_refptr<FakeContentLayer> root_; 275 scoped_refptr<FakeContentLayer> root_;
268 scoped_refptr<FakeContentLayer> child_; 276 scoped_refptr<FakeContentLayer> child_;
269 gfx::RectF child_damage_rect_; 277 gfx::RectF child_damage_rect_;
270 }; 278 };
271 279
272 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDamageTestForcedFullDamage); 280 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDamageTestForcedFullDamage);
273 281
274 } // namespace 282 } // namespace
275 } // namespace cc 283 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_context.cc ('k') | cc/trees/layer_tree_host_unittest_delegated.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698