Commit a971e271 authored by Chris Blume's avatar Chris Blume Committed by Commit Bot

Viz display unittests to use LSI allocator's copy

The LSI allocators previously did not store a copy of the last generated
LSI. As a result, many call sites would have to keep their own copies.

Now that the LSI allocators have their own copies, the call sites can be
updated to no longer store a separate copy.

Viz's display unittests are one such call site.

BUG=759031

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel
Change-Id: I9b689e7e22971baf9596fcc42ccc7ffb28a4b7af
Reviewed-on: https://chromium-review.googlesource.com/1008963
Commit-Queue: Fady Samuel <fsamuel@chromium.org>
Reviewed-by: default avatarFady Samuel <fsamuel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550161}
parent fb3061b1
......@@ -206,10 +206,9 @@ TEST_F(DisplayTest, DisplayDamaged) {
display_->Initialize(&client, manager_.surface_manager());
display_->SetColorSpace(color_space_1, color_space_1);
LocalSurfaceId local_surface_id(id_allocator_.GenerateId());
EXPECT_FALSE(scheduler_->damaged);
EXPECT_FALSE(scheduler_->has_new_root_surface);
display_->SetLocalSurfaceId(local_surface_id, 1.f);
display_->SetLocalSurfaceId(id_allocator_.GenerateId(), 1.f);
EXPECT_FALSE(scheduler_->damaged);
EXPECT_FALSE(scheduler_->display_resized_);
EXPECT_TRUE(scheduler_->has_new_root_surface);
......@@ -229,7 +228,7 @@ TEST_F(DisplayTest, DisplayDamaged) {
pass_list.push_back(std::move(pass));
scheduler_->ResetDamageForTest();
SubmitCompositorFrame(&pass_list, local_surface_id);
SubmitCompositorFrame(&pass_list, id_allocator_.GetCurrentLocalSurfaceId());
EXPECT_TRUE(scheduler_->damaged);
EXPECT_FALSE(scheduler_->display_resized_);
EXPECT_FALSE(scheduler_->has_new_root_surface);
......@@ -254,7 +253,7 @@ TEST_F(DisplayTest, DisplayDamaged) {
pass_list.push_back(std::move(pass));
scheduler_->ResetDamageForTest();
SubmitCompositorFrame(&pass_list, local_surface_id);
SubmitCompositorFrame(&pass_list, id_allocator_.GetCurrentLocalSurfaceId());
EXPECT_TRUE(scheduler_->damaged);
EXPECT_FALSE(scheduler_->display_resized_);
EXPECT_FALSE(scheduler_->has_new_root_surface);
......@@ -283,7 +282,7 @@ TEST_F(DisplayTest, DisplayDamaged) {
pass_list.push_back(std::move(pass));
scheduler_->ResetDamageForTest();
SubmitCompositorFrame(&pass_list, local_surface_id);
SubmitCompositorFrame(&pass_list, id_allocator_.GetCurrentLocalSurfaceId());
EXPECT_TRUE(scheduler_->damaged);
EXPECT_FALSE(scheduler_->display_resized_);
EXPECT_FALSE(scheduler_->has_new_root_surface);
......@@ -297,8 +296,7 @@ TEST_F(DisplayTest, DisplayDamaged) {
// Pass is wrong size so shouldn't be swapped. However, damage should
// result in latency info being stored for the next swap.
{
local_surface_id = id_allocator_.GenerateId();
display_->SetLocalSurfaceId(local_surface_id, 1.f);
display_->SetLocalSurfaceId(id_allocator_.GenerateId(), 1.f);
scheduler_->ResetDamageForTest();
......@@ -309,7 +307,8 @@ TEST_F(DisplayTest, DisplayDamaged) {
.AddLatencyInfo(ui::LatencyInfo())
.Build();
support_->SubmitCompositorFrame(local_surface_id, std::move(frame));
support_->SubmitCompositorFrame(id_allocator_.GetCurrentLocalSurfaceId(),
std::move(frame));
EXPECT_TRUE(scheduler_->damaged);
EXPECT_FALSE(scheduler_->display_resized_);
EXPECT_FALSE(scheduler_->has_new_root_surface);
......@@ -327,12 +326,11 @@ TEST_F(DisplayTest, DisplayDamaged) {
pass->damage_rect = gfx::Rect(10, 10, 0, 0);
pass->id = 1u;
local_surface_id = id_allocator_.GenerateId();
display_->SetLocalSurfaceId(local_surface_id, 1.f);
display_->SetLocalSurfaceId(id_allocator_.GenerateId(), 1.f);
pass_list.push_back(std::move(pass));
scheduler_->ResetDamageForTest();
SubmitCompositorFrame(&pass_list, local_surface_id);
SubmitCompositorFrame(&pass_list, id_allocator_.GetCurrentLocalSurfaceId());
EXPECT_TRUE(scheduler_->damaged);
EXPECT_FALSE(scheduler_->display_resized_);
EXPECT_FALSE(scheduler_->has_new_root_surface);
......@@ -362,7 +360,7 @@ TEST_F(DisplayTest, DisplayDamaged) {
pass_list.push_back(std::move(pass));
scheduler_->ResetDamageForTest();
SubmitCompositorFrame(&pass_list, local_surface_id);
SubmitCompositorFrame(&pass_list, id_allocator_.GetCurrentLocalSurfaceId());
EXPECT_TRUE(scheduler_->damaged);
EXPECT_FALSE(scheduler_->display_resized_);
EXPECT_FALSE(scheduler_->has_new_root_surface);
......@@ -386,7 +384,8 @@ TEST_F(DisplayTest, DisplayDamaged) {
.AddLatencyInfo(ui::LatencyInfo())
.Build();
support_->SubmitCompositorFrame(local_surface_id, std::move(frame));
support_->SubmitCompositorFrame(id_allocator_.GetCurrentLocalSurfaceId(),
std::move(frame));
EXPECT_TRUE(scheduler_->damaged);
EXPECT_FALSE(scheduler_->display_resized_);
EXPECT_FALSE(scheduler_->has_new_root_surface);
......@@ -400,8 +399,7 @@ TEST_F(DisplayTest, DisplayDamaged) {
// Resize should cause a swap if no frame was swapped at the previous size.
{
local_surface_id = id_allocator_.GenerateId();
display_->SetLocalSurfaceId(local_surface_id, 1.f);
display_->SetLocalSurfaceId(id_allocator_.GenerateId(), 1.f);
scheduler_->swapped = false;
display_->Resize(gfx::Size(200, 200));
EXPECT_FALSE(scheduler_->swapped);
......@@ -414,7 +412,8 @@ TEST_F(DisplayTest, DisplayDamaged) {
.AddRenderPass(kOutputRect, kDamageRect)
.Build();
support_->SubmitCompositorFrame(local_surface_id, std::move(frame));
support_->SubmitCompositorFrame(id_allocator_.GetCurrentLocalSurfaceId(),
std::move(frame));
EXPECT_TRUE(scheduler_->damaged);
EXPECT_FALSE(scheduler_->display_resized_);
EXPECT_FALSE(scheduler_->has_new_root_surface);
......@@ -431,8 +430,7 @@ TEST_F(DisplayTest, DisplayDamaged) {
// Surface that's damaged completely should be resized and swapped.
{
local_surface_id = id_allocator_.GenerateId();
display_->SetLocalSurfaceId(local_surface_id, 1.0f);
display_->SetLocalSurfaceId(id_allocator_.GenerateId(), 1.0f);
pass = RenderPass::Create();
pass->output_rect = gfx::Rect(0, 0, 99, 99);
pass->damage_rect = gfx::Rect(0, 0, 99, 99);
......@@ -440,7 +438,7 @@ TEST_F(DisplayTest, DisplayDamaged) {
pass_list.push_back(std::move(pass));
scheduler_->ResetDamageForTest();
SubmitCompositorFrame(&pass_list, local_surface_id);
SubmitCompositorFrame(&pass_list, id_allocator_.GetCurrentLocalSurfaceId());
EXPECT_TRUE(scheduler_->damaged);
EXPECT_FALSE(scheduler_->display_resized_);
EXPECT_FALSE(scheduler_->has_new_root_surface);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment