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

Unified Diff: ui/compositor/layer_unittest.cc

Issue 2018223002: Clear ui::Layer damaged_region_ after commit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« ui/compositor/layer.cc ('K') | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_unittest.cc
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc
index f24ad4659b42b8c3078d943566fed31b3cbc8fc9..6584ce1068f56fc858fe921d79a6c8e0a6606170 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -926,6 +926,30 @@ TEST_F(LayerWithNullDelegateTest, SetBoundsSchedulesPaint) {
WaitForDraw();
}
+// Checks that the damage rect for a TextureLayer is empty after a commit.
+TEST_F(LayerWithNullDelegateTest, EmptyDamagedRect) {
+ std::unique_ptr<Layer> root(CreateLayer(LAYER_SOLID_COLOR));
+ cc::TextureMailbox mailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), 0);
+ bool callback_run = false;
+ root->SetTextureMailbox(mailbox, cc::SingleReleaseCallback::Create(base::Bind(
+ ReturnMailbox, &callback_run)),
+ gfx::Size(10, 10));
+ compositor()->SetRootLayer(root.get());
+
+ root->SetBounds(gfx::Rect(0, 0, 10, 10));
+ root->SetVisible(true);
+ WaitForCommit();
+
+ gfx::Rect damaged_rect(0, 0, 5, 5);
+ root->SchedulePaint(damaged_rect);
+ EXPECT_EQ(damaged_rect,
+ root->damaged_region_for_testing()->bounds());
+ WaitForCommit();
+ EXPECT_TRUE(root->damaged_region_for_testing()->IsEmpty());
+
+ compositor()->SetRootLayer(nullptr);
+}
+
void ExpectRgba(int x, int y, SkColor expected_color, SkColor actual_color) {
EXPECT_EQ(expected_color, actual_color)
<< "Pixel error at x=" << x << " y=" << y << "; "
« ui/compositor/layer.cc ('K') | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698