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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 SetUpContext(nullptr); | 188 SetUpContext(nullptr); |
189 TestDisplayClient client; | 189 TestDisplayClient client; |
190 RendererSettings settings; | 190 RendererSettings settings; |
191 settings.partial_swap_enabled = true; | 191 settings.partial_swap_enabled = true; |
192 settings.finish_rendering_on_resize = true; | 192 settings.finish_rendering_on_resize = true; |
193 TestDisplay display(&client, &manager_, shared_bitmap_manager_.get(), nullptr, | 193 TestDisplay display(&client, &manager_, shared_bitmap_manager_.get(), nullptr, |
194 settings, id_allocator_.id_namespace()); | 194 settings, id_allocator_.id_namespace()); |
195 display.Initialize(std::move(output_surface_), task_runner_.get()); | 195 display.Initialize(std::move(output_surface_), task_runner_.get()); |
196 TestDisplayScheduler& scheduler = display.scheduler(); | 196 TestDisplayScheduler& scheduler = display.scheduler(); |
197 | 197 |
198 SurfaceId surface_id(id_allocator_.GenerateId()); | 198 SurfaceId surface_id; |
| 199 surface_id = id_allocator_.GenerateId(); |
199 EXPECT_FALSE(scheduler.damaged); | 200 EXPECT_FALSE(scheduler.damaged); |
200 EXPECT_FALSE(scheduler.has_new_root_surface); | 201 EXPECT_FALSE(scheduler.has_new_root_surface); |
201 display.SetSurfaceId(surface_id, 1.f); | 202 display.SetSurfaceId(surface_id, 1.f); |
202 EXPECT_FALSE(scheduler.damaged); | 203 EXPECT_FALSE(scheduler.damaged); |
203 EXPECT_FALSE(scheduler.display_resized_); | 204 EXPECT_FALSE(scheduler.display_resized_); |
204 EXPECT_TRUE(scheduler.has_new_root_surface); | 205 EXPECT_TRUE(scheduler.has_new_root_surface); |
205 | 206 |
206 scheduler.ResetDamageForTest(); | 207 scheduler.ResetDamageForTest(); |
207 display.Resize(gfx::Size(100, 100)); | 208 display.Resize(gfx::Size(100, 100)); |
208 EXPECT_FALSE(scheduler.damaged); | 209 EXPECT_FALSE(scheduler.damaged); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 MOCK_METHOD0(shallowFinishCHROMIUM, void()); | 445 MOCK_METHOD0(shallowFinishCHROMIUM, void()); |
445 }; | 446 }; |
446 | 447 |
447 TEST_F(DisplayTest, Finish) { | 448 TEST_F(DisplayTest, Finish) { |
448 std::unique_ptr<MockedContext> context(new MockedContext()); | 449 std::unique_ptr<MockedContext> context(new MockedContext()); |
449 MockedContext* context_ptr = context.get(); | 450 MockedContext* context_ptr = context.get(); |
450 SetUpContext(std::move(context)); | 451 SetUpContext(std::move(context)); |
451 | 452 |
452 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()).Times(0); | 453 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()).Times(0); |
453 | 454 |
454 SurfaceId surface_id(id_allocator_.GenerateId()); | 455 SurfaceId surface_id; |
| 456 surface_id = id_allocator_.GenerateId(); |
455 | 457 |
456 TestDisplayClient client; | 458 TestDisplayClient client; |
457 RendererSettings settings; | 459 RendererSettings settings; |
458 settings.partial_swap_enabled = true; | 460 settings.partial_swap_enabled = true; |
459 settings.finish_rendering_on_resize = true; | 461 settings.finish_rendering_on_resize = true; |
460 TestDisplay display(&client, &manager_, shared_bitmap_manager_.get(), nullptr, | 462 TestDisplay display(&client, &manager_, shared_bitmap_manager_.get(), nullptr, |
461 settings, surface_id.id_namespace()); | 463 settings, surface_id.id_namespace()); |
462 display.Initialize(std::move(output_surface_), task_runner_.get()); | 464 display.Initialize(std::move(output_surface_), task_runner_.get()); |
463 | 465 |
464 display.SetSurfaceId(surface_id, 1.f); | 466 display.SetSurfaceId(surface_id, 1.f); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 | 511 |
510 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()); | 512 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()); |
511 display.Resize(gfx::Size(250, 250)); | 513 display.Resize(gfx::Size(250, 250)); |
512 testing::Mock::VerifyAndClearExpectations(context_ptr); | 514 testing::Mock::VerifyAndClearExpectations(context_ptr); |
513 | 515 |
514 factory_.Destroy(surface_id); | 516 factory_.Destroy(surface_id); |
515 } | 517 } |
516 | 518 |
517 } // namespace | 519 } // namespace |
518 } // namespace cc | 520 } // namespace cc |
OLD | NEW |