| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 TEST_F(DisplayTest, DisplayDamaged) { | 177 TEST_F(DisplayTest, DisplayDamaged) { |
| 178 RendererSettings settings; | 178 RendererSettings settings; |
| 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 gfx::ColorSpace color_space_1 = gfx::ColorSpace::CreateXYZD50(); | 182 gfx::ColorSpace color_space_1 = gfx::ColorSpace::CreateXYZD50(); |
| 183 gfx::ColorSpace color_space_2 = gfx::ColorSpace::CreateSCRGBLinear(); | 183 gfx::ColorSpace color_space_2 = gfx::ColorSpace::CreateSCRGBLinear(); |
| 184 | 184 |
| 185 StubDisplayClient client; | 185 StubDisplayClient client; |
| 186 display_->Initialize(&client, &manager_); | 186 display_->Initialize(&client, &manager_); |
| 187 display_->SetColorSpace(color_space_1); | 187 display_->SetColorSpace(color_space_1, color_space_1); |
| 188 | 188 |
| 189 LocalSurfaceId local_surface_id(id_allocator_.GenerateId()); | 189 LocalSurfaceId local_surface_id(id_allocator_.GenerateId()); |
| 190 EXPECT_FALSE(scheduler_->damaged); | 190 EXPECT_FALSE(scheduler_->damaged); |
| 191 EXPECT_FALSE(scheduler_->has_new_root_surface); | 191 EXPECT_FALSE(scheduler_->has_new_root_surface); |
| 192 display_->SetLocalSurfaceId(local_surface_id, 1.f); | 192 display_->SetLocalSurfaceId(local_surface_id, 1.f); |
| 193 EXPECT_FALSE(scheduler_->damaged); | 193 EXPECT_FALSE(scheduler_->damaged); |
| 194 EXPECT_FALSE(scheduler_->display_resized_); | 194 EXPECT_FALSE(scheduler_->display_resized_); |
| 195 EXPECT_TRUE(scheduler_->has_new_root_surface); | 195 EXPECT_TRUE(scheduler_->has_new_root_surface); |
| 196 | 196 |
| 197 scheduler_->ResetDamageForTest(); | 197 scheduler_->ResetDamageForTest(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 234 |
| 235 pass_list.push_back(std::move(pass)); | 235 pass_list.push_back(std::move(pass)); |
| 236 scheduler_->ResetDamageForTest(); | 236 scheduler_->ResetDamageForTest(); |
| 237 SubmitCompositorFrame(&pass_list, local_surface_id); | 237 SubmitCompositorFrame(&pass_list, local_surface_id); |
| 238 EXPECT_TRUE(scheduler_->damaged); | 238 EXPECT_TRUE(scheduler_->damaged); |
| 239 EXPECT_FALSE(scheduler_->display_resized_); | 239 EXPECT_FALSE(scheduler_->display_resized_); |
| 240 EXPECT_FALSE(scheduler_->has_new_root_surface); | 240 EXPECT_FALSE(scheduler_->has_new_root_surface); |
| 241 | 241 |
| 242 scheduler_->swapped = false; | 242 scheduler_->swapped = false; |
| 243 EXPECT_EQ(color_space_1, output_surface_->last_reshape_color_space()); | 243 EXPECT_EQ(color_space_1, output_surface_->last_reshape_color_space()); |
| 244 display_->SetColorSpace(color_space_2); | 244 display_->SetColorSpace(color_space_2, color_space_2); |
| 245 display_->DrawAndSwap(); | 245 display_->DrawAndSwap(); |
| 246 EXPECT_EQ(color_space_2, output_surface_->last_reshape_color_space()); | 246 EXPECT_EQ(color_space_2, output_surface_->last_reshape_color_space()); |
| 247 EXPECT_TRUE(scheduler_->swapped); | 247 EXPECT_TRUE(scheduler_->swapped); |
| 248 EXPECT_EQ(2u, output_surface_->num_sent_frames()); | 248 EXPECT_EQ(2u, output_surface_->num_sent_frames()); |
| 249 EXPECT_EQ(gfx::Size(100, 100), | 249 EXPECT_EQ(gfx::Size(100, 100), |
| 250 software_output_device_->viewport_pixel_size()); | 250 software_output_device_->viewport_pixel_size()); |
| 251 EXPECT_EQ(gfx::Rect(10, 10, 1, 1), software_output_device_->damage_rect()); | 251 EXPECT_EQ(gfx::Rect(10, 10, 1, 1), software_output_device_->damage_rect()); |
| 252 } | 252 } |
| 253 | 253 |
| 254 { | 254 { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 // Verify DidLoseOutputSurface callback is hooked up correctly. | 515 // Verify DidLoseOutputSurface callback is hooked up correctly. |
| 516 EXPECT_EQ(0, client.loss_count()); | 516 EXPECT_EQ(0, client.loss_count()); |
| 517 output_surface_->context_provider()->ContextGL()->LoseContextCHROMIUM( | 517 output_surface_->context_provider()->ContextGL()->LoseContextCHROMIUM( |
| 518 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); | 518 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); |
| 519 output_surface_->context_provider()->ContextGL()->Flush(); | 519 output_surface_->context_provider()->ContextGL()->Flush(); |
| 520 EXPECT_EQ(1, client.loss_count()); | 520 EXPECT_EQ(1, client.loss_count()); |
| 521 } | 521 } |
| 522 | 522 |
| 523 } // namespace | 523 } // namespace |
| 524 } // namespace cc | 524 } // namespace cc |
| OLD | NEW |