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 << "; " |