| 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/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/test/null_task_runner.h" | 10 #include "base/test/null_task_runner.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 settings.partial_swap_enabled = true; | 179 settings.partial_swap_enabled = true; |
| 180 settings.finish_rendering_on_resize = true; | 180 settings.finish_rendering_on_resize = true; |
| 181 SetUpDisplay(settings, nullptr); | 181 SetUpDisplay(settings, nullptr); |
| 182 | 182 |
| 183 StubDisplayClient client; | 183 StubDisplayClient client; |
| 184 display_->Initialize(&client, &manager_); | 184 display_->Initialize(&client, &manager_); |
| 185 | 185 |
| 186 LocalSurfaceId local_surface_id(id_allocator_.GenerateId()); | 186 LocalSurfaceId local_surface_id(id_allocator_.GenerateId()); |
| 187 EXPECT_FALSE(scheduler_->damaged); | 187 EXPECT_FALSE(scheduler_->damaged); |
| 188 EXPECT_FALSE(scheduler_->has_new_root_surface); | 188 EXPECT_FALSE(scheduler_->has_new_root_surface); |
| 189 display_->SetLocalSurfaceId(local_surface_id, 1.f); | 189 display_->SetLocalSurfaceId(local_surface_id); |
| 190 display_->SetDeviceScaleFactor(1.f); |
| 190 EXPECT_FALSE(scheduler_->damaged); | 191 EXPECT_FALSE(scheduler_->damaged); |
| 191 EXPECT_FALSE(scheduler_->display_resized_); | 192 EXPECT_FALSE(scheduler_->display_resized_); |
| 192 EXPECT_TRUE(scheduler_->has_new_root_surface); | 193 EXPECT_TRUE(scheduler_->has_new_root_surface); |
| 193 | 194 |
| 194 scheduler_->ResetDamageForTest(); | 195 scheduler_->ResetDamageForTest(); |
| 195 display_->Resize(gfx::Size(100, 100)); | 196 display_->Resize(gfx::Size(100, 100)); |
| 196 EXPECT_FALSE(scheduler_->damaged); | 197 EXPECT_FALSE(scheduler_->damaged); |
| 197 EXPECT_TRUE(scheduler_->display_resized_); | 198 EXPECT_TRUE(scheduler_->display_resized_); |
| 198 EXPECT_FALSE(scheduler_->has_new_root_surface); | 199 EXPECT_FALSE(scheduler_->has_new_root_surface); |
| 199 | 200 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 430 |
| 430 std::unique_ptr<MockedContext> context(new MockedContext()); | 431 std::unique_ptr<MockedContext> context(new MockedContext()); |
| 431 MockedContext* context_ptr = context.get(); | 432 MockedContext* context_ptr = context.get(); |
| 432 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()).Times(0); | 433 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()).Times(0); |
| 433 | 434 |
| 434 SetUpDisplay(settings, std::move(context)); | 435 SetUpDisplay(settings, std::move(context)); |
| 435 | 436 |
| 436 StubDisplayClient client; | 437 StubDisplayClient client; |
| 437 display_->Initialize(&client, &manager_); | 438 display_->Initialize(&client, &manager_); |
| 438 | 439 |
| 439 display_->SetLocalSurfaceId(local_surface_id, 1.f); | 440 display_->SetLocalSurfaceId(local_surface_id); |
| 441 display_->SetDeviceScaleFactor(1.f); |
| 440 | 442 |
| 441 display_->Resize(gfx::Size(100, 100)); | 443 display_->Resize(gfx::Size(100, 100)); |
| 442 | 444 |
| 443 { | 445 { |
| 444 RenderPassList pass_list; | 446 RenderPassList pass_list; |
| 445 std::unique_ptr<RenderPass> pass = RenderPass::Create(); | 447 std::unique_ptr<RenderPass> pass = RenderPass::Create(); |
| 446 pass->output_rect = gfx::Rect(0, 0, 100, 100); | 448 pass->output_rect = gfx::Rect(0, 0, 100, 100); |
| 447 pass->damage_rect = gfx::Rect(10, 10, 1, 1); | 449 pass->damage_rect = gfx::Rect(10, 10, 1, 1); |
| 448 pass->id = 1; | 450 pass->id = 1; |
| 449 pass_list.push_back(std::move(pass)); | 451 pass_list.push_back(std::move(pass)); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 // Verify DidLoseOutputSurface callback is hooked up correctly. | 509 // Verify DidLoseOutputSurface callback is hooked up correctly. |
| 508 EXPECT_EQ(0, client.loss_count()); | 510 EXPECT_EQ(0, client.loss_count()); |
| 509 output_surface_->context_provider()->ContextGL()->LoseContextCHROMIUM( | 511 output_surface_->context_provider()->ContextGL()->LoseContextCHROMIUM( |
| 510 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); | 512 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); |
| 511 output_surface_->context_provider()->ContextGL()->Flush(); | 513 output_surface_->context_provider()->ContextGL()->Flush(); |
| 512 EXPECT_EQ(1, client.loss_count()); | 514 EXPECT_EQ(1, client.loss_count()); |
| 513 } | 515 } |
| 514 | 516 |
| 515 } // namespace | 517 } // namespace |
| 516 } // namespace cc | 518 } // namespace cc |
| OLD | NEW |