summaryrefslogtreecommitdiffstats
path: root/cc/surfaces/display_unittest.cc
diff options
context:
space:
mode:
authorjbauman <jbauman@chromium.org>2015-08-19 18:58:22 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-20 01:59:02 +0000
commit7a402ba51bf75c883cde14c8bd83fa082f685c08 (patch)
treeb8e6e1eec15297cd1f9fa4e7826d920e9cd7379f /cc/surfaces/display_unittest.cc
parente88fc6f755bd832ba009fe7733ab553d59e759ac (diff)
downloadchromium_src-7a402ba51bf75c883cde14c8bd83fa082f685c08.zip
chromium_src-7a402ba51bf75c883cde14c8bd83fa082f685c08.tar.gz
chromium_src-7a402ba51bf75c883cde14c8bd83fa082f685c08.tar.bz2
Ensure surface swap happens after resize.
Resizing essentially damages the output, so ensure a resize causes a new draw to happen. Also, missing a draw that had damage should cause the next frame that's drawn to be completely damaged. This matters in particular if the window gets a resize event but the size doesn't actually change - in that case the browser compositor won't draw a new frame at a different size with full damage. BUG=517035 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1298853002 Cr-Commit-Position: refs/heads/master@{#344403}
Diffstat (limited to 'cc/surfaces/display_unittest.cc')
-rw-r--r--cc/surfaces/display_unittest.cc30
1 files changed, 26 insertions, 4 deletions
diff --git a/cc/surfaces/display_unittest.cc b/cc/surfaces/display_unittest.cc
index b7b50c3..facb40e9 100644
--- a/cc/surfaces/display_unittest.cc
+++ b/cc/surfaces/display_unittest.cc
@@ -253,6 +253,28 @@ TEST_F(DisplayTest, DisplayDamaged) {
}
{
+ // Previous frame wasn't swapped, so next swap should have full damage.
+ pass = RenderPass::Create();
+ pass->output_rect = gfx::Rect(0, 0, 100, 100);
+ pass->damage_rect = gfx::Rect(10, 10, 0, 0);
+ pass->id = RenderPassId(1, 1);
+
+ pass_list.push_back(pass.Pass());
+ scheduler.ResetDamageForTest();
+ SubmitFrame(&pass_list, surface_id);
+ EXPECT_TRUE(scheduler.damaged);
+ EXPECT_FALSE(scheduler.display_resized_);
+ EXPECT_FALSE(scheduler.has_new_root_surface);
+
+ scheduler.swapped = false;
+ display.DrawAndSwap();
+ EXPECT_TRUE(scheduler.swapped);
+ EXPECT_EQ(3u, output_surface_ptr_->num_sent_frames());
+ EXPECT_EQ(gfx::Rect(0, 0, 100, 100),
+ software_output_device_->damage_rect());
+ }
+
+ {
// Pass has copy output request so should be swapped.
pass = RenderPass::Create();
pass->output_rect = gfx::Rect(0, 0, 100, 100);
@@ -272,7 +294,7 @@ TEST_F(DisplayTest, DisplayDamaged) {
scheduler.swapped = false;
display.DrawAndSwap();
EXPECT_TRUE(scheduler.swapped);
- EXPECT_EQ(3u, output_surface_ptr_->num_sent_frames());
+ EXPECT_EQ(4u, output_surface_ptr_->num_sent_frames());
EXPECT_TRUE(copy_called);
}
@@ -301,7 +323,7 @@ TEST_F(DisplayTest, DisplayDamaged) {
scheduler.swapped = false;
display.DrawAndSwap();
EXPECT_TRUE(scheduler.swapped);
- EXPECT_EQ(4u, output_surface_ptr_->num_sent_frames());
+ EXPECT_EQ(5u, output_surface_ptr_->num_sent_frames());
}
// Resize should cause a swap if no frame was swapped at the previous size.
@@ -309,7 +331,7 @@ TEST_F(DisplayTest, DisplayDamaged) {
scheduler.swapped = false;
display.Resize(gfx::Size(200, 200));
EXPECT_FALSE(scheduler.swapped);
- EXPECT_EQ(4u, output_surface_ptr_->num_sent_frames());
+ EXPECT_EQ(5u, output_surface_ptr_->num_sent_frames());
pass = RenderPass::Create();
pass->output_rect = gfx::Rect(0, 0, 200, 200);
@@ -333,7 +355,7 @@ TEST_F(DisplayTest, DisplayDamaged) {
scheduler.swapped = false;
display.Resize(gfx::Size(100, 100));
EXPECT_TRUE(scheduler.swapped);
- EXPECT_EQ(5u, output_surface_ptr_->num_sent_frames());
+ EXPECT_EQ(6u, output_surface_ptr_->num_sent_frames());
}
factory_.Destroy(surface_id);