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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 EXPECT_FALSE(scheduler_->display_resized_); | 379 EXPECT_FALSE(scheduler_->display_resized_); |
380 EXPECT_FALSE(scheduler_->has_new_root_surface); | 380 EXPECT_FALSE(scheduler_->has_new_root_surface); |
381 | 381 |
382 scheduler_->swapped = false; | 382 scheduler_->swapped = false; |
383 display_->Resize(gfx::Size(100, 100)); | 383 display_->Resize(gfx::Size(100, 100)); |
384 EXPECT_TRUE(scheduler_->swapped); | 384 EXPECT_TRUE(scheduler_->swapped); |
385 EXPECT_EQ(5u, output_surface_->num_sent_frames()); | 385 EXPECT_EQ(5u, output_surface_->num_sent_frames()); |
386 | 386 |
387 // Latency info from previous frame should be sent now. | 387 // Latency info from previous frame should be sent now. |
388 EXPECT_EQ(1u, | 388 EXPECT_EQ(1u, |
389 output_surface_->last_sent_frame().metadata.latency_info.size()); | 389 output_surface_->last_sent_frame()->metadata.latency_info.size()); |
390 } | 390 } |
391 | 391 |
392 { | 392 { |
393 // Surface that's damaged completely should be resized and swapped. | 393 // Surface that's damaged completely should be resized and swapped. |
394 pass = RenderPass::Create(); | 394 pass = RenderPass::Create(); |
395 pass->output_rect = gfx::Rect(0, 0, 99, 99); | 395 pass->output_rect = gfx::Rect(0, 0, 99, 99); |
396 pass->damage_rect = gfx::Rect(0, 0, 99, 99); | 396 pass->damage_rect = gfx::Rect(0, 0, 99, 99); |
397 pass->id = RenderPassId(1, 1); | 397 pass->id = RenderPassId(1, 1); |
398 | 398 |
399 pass_list.push_back(std::move(pass)); | 399 pass_list.push_back(std::move(pass)); |
400 scheduler_->ResetDamageForTest(); | 400 scheduler_->ResetDamageForTest(); |
401 SubmitCompositorFrame(&pass_list, surface_id); | 401 SubmitCompositorFrame(&pass_list, surface_id); |
402 EXPECT_TRUE(scheduler_->damaged); | 402 EXPECT_TRUE(scheduler_->damaged); |
403 EXPECT_FALSE(scheduler_->display_resized_); | 403 EXPECT_FALSE(scheduler_->display_resized_); |
404 EXPECT_FALSE(scheduler_->has_new_root_surface); | 404 EXPECT_FALSE(scheduler_->has_new_root_surface); |
405 | 405 |
406 scheduler_->swapped = false; | 406 scheduler_->swapped = false; |
407 display_->DrawAndSwap(); | 407 display_->DrawAndSwap(); |
408 EXPECT_TRUE(scheduler_->swapped); | 408 EXPECT_TRUE(scheduler_->swapped); |
409 EXPECT_EQ(6u, output_surface_->num_sent_frames()); | 409 EXPECT_EQ(6u, output_surface_->num_sent_frames()); |
410 EXPECT_EQ(gfx::Size(100, 100), | 410 EXPECT_EQ(gfx::Size(100, 100), |
411 software_output_device_->viewport_pixel_size()); | 411 software_output_device_->viewport_pixel_size()); |
412 EXPECT_EQ(gfx::Rect(0, 0, 100, 100), | 412 EXPECT_EQ(gfx::Rect(0, 0, 100, 100), |
413 software_output_device_->damage_rect()); | 413 software_output_device_->damage_rect()); |
414 EXPECT_EQ(0u, | 414 EXPECT_EQ(0u, |
415 output_surface_->last_sent_frame().metadata.latency_info.size()); | 415 output_surface_->last_sent_frame()->metadata.latency_info.size()); |
416 } | 416 } |
417 | 417 |
418 factory_.Destroy(surface_id); | 418 factory_.Destroy(surface_id); |
419 } | 419 } |
420 | 420 |
421 class MockedContext : public TestWebGraphicsContext3D { | 421 class MockedContext : public TestWebGraphicsContext3D { |
422 public: | 422 public: |
423 MOCK_METHOD0(shallowFinishCHROMIUM, void()); | 423 MOCK_METHOD0(shallowFinishCHROMIUM, void()); |
424 }; | 424 }; |
425 | 425 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 487 |
488 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()); | 488 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()); |
489 display_->Resize(gfx::Size(250, 250)); | 489 display_->Resize(gfx::Size(250, 250)); |
490 testing::Mock::VerifyAndClearExpectations(context_ptr); | 490 testing::Mock::VerifyAndClearExpectations(context_ptr); |
491 | 491 |
492 factory_.Destroy(surface_id); | 492 factory_.Destroy(surface_id); |
493 } | 493 } |
494 | 494 |
495 } // namespace | 495 } // namespace |
496 } // namespace cc | 496 } // namespace cc |
OLD | NEW |