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

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
« no previous file with comments | « 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..1c8d97976f1f5d58c60f5d222fdac0b02ec5b842 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -926,6 +926,33 @@ TEST_F(LayerWithNullDelegateTest, SetBoundsSchedulesPaint) {
WaitForDraw();
}
+static void EmptyReleaseCallback(const gpu::SyncToken& sync_token,
+ bool is_lost) {}
+
+// 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);
+ root->SetTextureMailbox(mailbox, cc::SingleReleaseCallback::Create(
+ base::Bind(EmptyReleaseCallback)),
+ 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);
+ root.reset();
+ WaitForCommit();
+}
+
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 << "; "
« no previous file with comments | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698