Chromium Code Reviews| Index: cc/surfaces/display_unittest.cc |
| diff --git a/cc/surfaces/display_unittest.cc b/cc/surfaces/display_unittest.cc |
| index 4bd0f4e13230cab12dcf9245b28e4d1d54fe7e19..9d7b1feaa2fb98a8c3cbbb60a53f76485407f593 100644 |
| --- a/cc/surfaces/display_unittest.cc |
| +++ b/cc/surfaces/display_unittest.cc |
| @@ -435,6 +435,62 @@ TEST_F(DisplayTest, DisplayDamaged) { |
| TearDownDisplay(); |
| } |
| +// Check LatencyInfo storage is cleaned up if it exceeds the limit. |
| +TEST_F(DisplayTest, MaxLatencyInfoCap) { |
| + RendererSettings settings; |
| + settings.partial_swap_enabled = true; |
| + settings.finish_rendering_on_resize = true; |
| + SetUpDisplay(settings, nullptr); |
| + gfx::ColorSpace color_space_1 = gfx::ColorSpace::CreateXYZD50(); |
| + gfx::ColorSpace color_space_2 = gfx::ColorSpace::CreateSCRGBLinear(); |
| + |
| + StubDisplayClient client; |
| + display_->Initialize(&client, &manager_); |
| + display_->SetColorSpace(color_space_1, color_space_1); |
| + |
| + LocalSurfaceId local_surface_id(id_allocator_.GenerateId()); |
| + display_->SetLocalSurfaceId(local_surface_id, 1.f); |
| + |
| + scheduler_->ResetDamageForTest(); |
| + display_->Resize(gfx::Size(100, 100)); |
| + |
| + RenderPassList pass_list; |
| + std::unique_ptr<RenderPass> pass = RenderPass::Create(); |
| + pass->output_rect = gfx::Rect(0, 0, 100, 100); |
| + pass->damage_rect = gfx::Rect(10, 10, 1, 1); |
| + pass->id = 1u; |
| + pass_list.push_back(std::move(pass)); |
| + |
| + scheduler_->ResetDamageForTest(); |
| + SubmitCompositorFrame(&pass_list, local_surface_id); |
| + |
| + display_->DrawAndSwap(); |
| + |
| + // This is the same as LatencyInfo::kMaxLAtencyInfoNumber. |
|
tdresser
2017/07/04 16:41:04
kMaxLA -> kMaxLa
Navid Zolghadr
2017/07/04 17:16:28
Done.
|
| + const size_t max_latency_info_count = 100; |
| + for (size_t i = 0; i <= max_latency_info_count; ++i) { |
| + pass = RenderPass::Create(); |
| + pass->output_rect = gfx::Rect(0, 0, 100, 100); |
| + pass->damage_rect = gfx::Rect(10, 10, 0, 0); |
| + pass->id = 1u; |
| + |
| + pass_list.push_back(std::move(pass)); |
| + scheduler_->ResetDamageForTest(); |
| + |
| + CompositorFrame frame = test::MakeCompositorFrame(); |
| + pass_list.swap(frame.render_pass_list); |
| + frame.metadata.latency_info.push_back(ui::LatencyInfo()); |
| + |
| + support_->SubmitCompositorFrame(local_surface_id, std::move(frame)); |
| + |
| + display_->DrawAndSwap(); |
| + EXPECT_EQ(i < max_latency_info_count ? (i + 1) : 0, |
| + display_->stored_latency_info_size_for_testing()); |
|
tdresser
2017/07/04 16:41:04
I think this would be a bit easier to read if you
Navid Zolghadr
2017/07/04 17:16:28
Done.
|
| + } |
| + |
| + TearDownDisplay(); |
| +} |
| + |
| class MockedContext : public TestWebGraphicsContext3D { |
| public: |
| MOCK_METHOD0(shallowFinishCHROMIUM, void()); |