OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/surfaces/display.h" | 5 #include "cc/surfaces/display.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/test/null_task_runner.h" | 9 #include "base/test/null_task_runner.h" |
10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 software_output_device_ = device.get(); | 116 software_output_device_ = device.get(); |
117 output_surface = FakeOutputSurface::CreateSoftware(std::move(device)); | 117 output_surface = FakeOutputSurface::CreateSoftware(std::move(device)); |
118 } | 118 } |
119 output_surface_ = output_surface.get(); | 119 output_surface_ = output_surface.get(); |
120 | 120 |
121 std::unique_ptr<TestDisplayScheduler> scheduler( | 121 std::unique_ptr<TestDisplayScheduler> scheduler( |
122 new TestDisplayScheduler(begin_frame_source.get(), task_runner_.get())); | 122 new TestDisplayScheduler(begin_frame_source.get(), task_runner_.get())); |
123 scheduler_ = scheduler.get(); | 123 scheduler_ = scheduler.get(); |
124 | 124 |
125 display_ = base::MakeUnique<Display>( | 125 display_ = base::MakeUnique<Display>( |
126 &manager_, &shared_bitmap_manager_, | 126 &shared_bitmap_manager_, nullptr /* gpu_memory_buffer_manager */, |
127 nullptr /* gpu_memory_buffer_manager */, settings, | 127 settings, std::move(begin_frame_source), std::move(output_surface), |
128 id_allocator_.client_id(), std::move(begin_frame_source), | 128 std::move(scheduler), |
129 std::move(output_surface), std::move(scheduler), | |
130 base::MakeUnique<TextureMailboxDeleter>(task_runner_.get())); | 129 base::MakeUnique<TextureMailboxDeleter>(task_runner_.get())); |
131 } | 130 } |
132 | 131 |
133 protected: | 132 protected: |
134 void SubmitCompositorFrame(RenderPassList* pass_list, | 133 void SubmitCompositorFrame(RenderPassList* pass_list, |
135 const SurfaceId& surface_id) { | 134 const SurfaceId& surface_id) { |
136 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); | 135 std::unique_ptr<DelegatedFrameData> frame_data(new DelegatedFrameData); |
137 pass_list->swap(frame_data->render_pass_list); | 136 pass_list->swap(frame_data->render_pass_list); |
138 | 137 |
139 CompositorFrame frame; | 138 CompositorFrame frame; |
(...skipping 28 matching lines...) Expand all Loading... |
168 } | 167 } |
169 | 168 |
170 // Check that frame is damaged and swapped only under correct conditions. | 169 // Check that frame is damaged and swapped only under correct conditions. |
171 TEST_F(DisplayTest, DisplayDamaged) { | 170 TEST_F(DisplayTest, DisplayDamaged) { |
172 RendererSettings settings; | 171 RendererSettings settings; |
173 settings.partial_swap_enabled = true; | 172 settings.partial_swap_enabled = true; |
174 settings.finish_rendering_on_resize = true; | 173 settings.finish_rendering_on_resize = true; |
175 SetUpDisplay(settings, nullptr); | 174 SetUpDisplay(settings, nullptr); |
176 | 175 |
177 StubDisplayClient client; | 176 StubDisplayClient client; |
178 display_->Initialize(&client); | 177 display_->Initialize(&client, &manager_, id_allocator_.client_id()); |
179 | 178 |
180 SurfaceId surface_id(id_allocator_.GenerateId()); | 179 SurfaceId surface_id(id_allocator_.GenerateId()); |
181 EXPECT_FALSE(scheduler_->damaged); | 180 EXPECT_FALSE(scheduler_->damaged); |
182 EXPECT_FALSE(scheduler_->has_new_root_surface); | 181 EXPECT_FALSE(scheduler_->has_new_root_surface); |
183 display_->SetSurfaceId(surface_id, 1.f); | 182 display_->SetSurfaceId(surface_id, 1.f); |
184 EXPECT_FALSE(scheduler_->damaged); | 183 EXPECT_FALSE(scheduler_->damaged); |
185 EXPECT_FALSE(scheduler_->display_resized_); | 184 EXPECT_FALSE(scheduler_->display_resized_); |
186 EXPECT_TRUE(scheduler_->has_new_root_surface); | 185 EXPECT_TRUE(scheduler_->has_new_root_surface); |
187 | 186 |
188 scheduler_->ResetDamageForTest(); | 187 scheduler_->ResetDamageForTest(); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 settings.partial_swap_enabled = true; | 430 settings.partial_swap_enabled = true; |
432 settings.finish_rendering_on_resize = true; | 431 settings.finish_rendering_on_resize = true; |
433 | 432 |
434 std::unique_ptr<MockedContext> context(new MockedContext()); | 433 std::unique_ptr<MockedContext> context(new MockedContext()); |
435 MockedContext* context_ptr = context.get(); | 434 MockedContext* context_ptr = context.get(); |
436 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()).Times(0); | 435 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()).Times(0); |
437 | 436 |
438 SetUpDisplay(settings, std::move(context)); | 437 SetUpDisplay(settings, std::move(context)); |
439 | 438 |
440 StubDisplayClient client; | 439 StubDisplayClient client; |
441 display_->Initialize(&client); | 440 display_->Initialize(&client, &manager_, id_allocator_.client_id()); |
442 | 441 |
443 display_->SetSurfaceId(surface_id, 1.f); | 442 display_->SetSurfaceId(surface_id, 1.f); |
444 | 443 |
445 display_->Resize(gfx::Size(100, 100)); | 444 display_->Resize(gfx::Size(100, 100)); |
446 factory_.Create(surface_id); | 445 factory_.Create(surface_id); |
447 | 446 |
448 { | 447 { |
449 RenderPassList pass_list; | 448 RenderPassList pass_list; |
450 std::unique_ptr<RenderPass> pass = RenderPass::Create(); | 449 std::unique_ptr<RenderPass> pass = RenderPass::Create(); |
451 pass->output_rect = gfx::Rect(0, 0, 100, 100); | 450 pass->output_rect = gfx::Rect(0, 0, 100, 100); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 487 |
489 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()); | 488 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()); |
490 display_->Resize(gfx::Size(250, 250)); | 489 display_->Resize(gfx::Size(250, 250)); |
491 testing::Mock::VerifyAndClearExpectations(context_ptr); | 490 testing::Mock::VerifyAndClearExpectations(context_ptr); |
492 | 491 |
493 factory_.Destroy(surface_id); | 492 factory_.Destroy(surface_id); |
494 } | 493 } |
495 | 494 |
496 } // namespace | 495 } // namespace |
497 } // namespace cc | 496 } // namespace cc |
OLD | NEW |