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