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

Side by Side Diff: cc/damage_tracker_unittest.cc

Issue 11491007: cc: Remove dangerous LayerImpl::removeFromParent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
« no previous file with comments | « no previous file | cc/layer_impl.h » ('j') | cc/layer_impl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/damage_tracker.h" 5 #include "cc/damage_tracker.h"
6 6
7 #include "cc/layer_impl.h" 7 #include "cc/layer_impl.h"
8 #include "cc/layer_tree_host_common.h" 8 #include "cc/layer_tree_host_common.h"
9 #include "cc/math_util.h" 9 #include "cc/math_util.h"
10 #include "cc/single_thread_proxy.h" 10 #include "cc/single_thread_proxy.h"
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 554
555 // CASE 2: If the layer is removed, its entire old layer becomes exposed, no t just the 555 // CASE 2: If the layer is removed, its entire old layer becomes exposed, no t just the
556 // last update rect. 556 // last update rect.
557 557
558 // Advance one frame without damage so that we know the damage rect is not l eftover from the previous case. 558 // Advance one frame without damage so that we know the damage rect is not l eftover from the previous case.
559 clearDamageForAllSurfaces(root.get()); 559 clearDamageForAllSurfaces(root.get());
560 emulateDrawingOneFrame(root.get()); 560 emulateDrawingOneFrame(root.get());
561 EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().IsEm pty()); 561 EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().IsEm pty());
562 562
563 // Then, test removing child1. 563 // Then, test removing child1.
564 child1->removeFromParent(); 564 root->removeChild(child1);
565 child1 = NULL;
565 emulateDrawingOneFrame(root.get()); 566 emulateDrawingOneFrame(root.get());
566 rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect() ; 567 rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect() ;
567 EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect); 568 EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect);
568 } 569 }
569 570
570 TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer) 571 TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer)
571 { 572 {
572 // If child2 is added to the layer tree, but it doesn't have any explicit da mage of 573 // If child2 is added to the layer tree, but it doesn't have any explicit da mage of
573 // its own, it should still indeed damage the target surface. 574 // its own, it should still indeed damage the target surface.
574 575
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 EXPECT_TRUE(rootDamageRect.IsEmpty()); 1163 EXPECT_TRUE(rootDamageRect.IsEmpty());
1163 1164
1164 // Damage should remain empty even after one frame, since there's yet no new damage 1165 // Damage should remain empty even after one frame, since there's yet no new damage
1165 emulateDrawingOneFrame(root.get()); 1166 emulateDrawingOneFrame(root.get());
1166 rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect() ; 1167 rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect() ;
1167 EXPECT_TRUE(rootDamageRect.IsEmpty()); 1168 EXPECT_TRUE(rootDamageRect.IsEmpty());
1168 } 1169 }
1169 1170
1170 } // namespace 1171 } // namespace
1171 } // namespace cc 1172 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layer_impl.h » ('j') | cc/layer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698