| 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 "base/test/null_task_runner.h" | 5 #include "base/test/null_task_runner.h" |
| 6 #include "cc/output/compositor_frame.h" | 6 #include "cc/output/compositor_frame.h" |
| 7 #include "cc/output/copy_output_result.h" | 7 #include "cc/output/copy_output_result.h" |
| 8 #include "cc/output/delegated_frame_data.h" | 8 #include "cc/output/delegated_frame_data.h" |
| 9 #include "cc/quads/render_pass.h" | 9 #include "cc/quads/render_pass.h" |
| 10 #include "cc/resources/shared_bitmap_manager.h" | 10 #include "cc/resources/shared_bitmap_manager.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 EXPECT_TRUE(scheduler.damaged); | 388 EXPECT_TRUE(scheduler.damaged); |
| 389 EXPECT_FALSE(scheduler.display_resized_); | 389 EXPECT_FALSE(scheduler.display_resized_); |
| 390 EXPECT_FALSE(scheduler.has_new_root_surface); | 390 EXPECT_FALSE(scheduler.has_new_root_surface); |
| 391 | 391 |
| 392 scheduler.swapped = false; | 392 scheduler.swapped = false; |
| 393 display.Resize(gfx::Size(100, 100)); | 393 display.Resize(gfx::Size(100, 100)); |
| 394 EXPECT_TRUE(scheduler.swapped); | 394 EXPECT_TRUE(scheduler.swapped); |
| 395 EXPECT_EQ(6u, output_surface_ptr_->num_sent_frames()); | 395 EXPECT_EQ(6u, output_surface_ptr_->num_sent_frames()); |
| 396 } | 396 } |
| 397 | 397 |
| 398 { |
| 399 // Surface that's damaged completely should be resized and swapped. |
| 400 pass = RenderPass::Create(); |
| 401 pass->output_rect = gfx::Rect(0, 0, 99, 99); |
| 402 pass->damage_rect = gfx::Rect(0, 0, 99, 99); |
| 403 pass->id = RenderPassId(1, 1); |
| 404 |
| 405 pass_list.push_back(pass.Pass()); |
| 406 scheduler.ResetDamageForTest(); |
| 407 SubmitCompositorFrame(&pass_list, surface_id); |
| 408 EXPECT_TRUE(scheduler.damaged); |
| 409 EXPECT_FALSE(scheduler.display_resized_); |
| 410 EXPECT_FALSE(scheduler.has_new_root_surface); |
| 411 |
| 412 scheduler.swapped = false; |
| 413 display.DrawAndSwap(); |
| 414 EXPECT_TRUE(scheduler.swapped); |
| 415 EXPECT_EQ(7u, output_surface_ptr_->num_sent_frames()); |
| 416 EXPECT_EQ(gfx::Size(100, 100), |
| 417 software_output_device_->viewport_pixel_size()); |
| 418 EXPECT_EQ(gfx::Rect(0, 0, 100, 100), |
| 419 software_output_device_->damage_rect()); |
| 420 } |
| 421 |
| 398 factory_.Destroy(surface_id); | 422 factory_.Destroy(surface_id); |
| 399 } | 423 } |
| 400 | 424 |
| 401 class MockedContext : public TestWebGraphicsContext3D { | 425 class MockedContext : public TestWebGraphicsContext3D { |
| 402 public: | 426 public: |
| 403 MOCK_METHOD0(shallowFinishCHROMIUM, void()); | 427 MOCK_METHOD0(shallowFinishCHROMIUM, void()); |
| 404 }; | 428 }; |
| 405 | 429 |
| 406 TEST_F(DisplayTest, Finish) { | 430 TEST_F(DisplayTest, Finish) { |
| 407 scoped_ptr<MockedContext> context(new MockedContext()); | 431 scoped_ptr<MockedContext> context(new MockedContext()); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 | 493 |
| 470 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()); | 494 EXPECT_CALL(*context_ptr, shallowFinishCHROMIUM()); |
| 471 display.Resize(gfx::Size(250, 250)); | 495 display.Resize(gfx::Size(250, 250)); |
| 472 testing::Mock::VerifyAndClearExpectations(context_ptr); | 496 testing::Mock::VerifyAndClearExpectations(context_ptr); |
| 473 | 497 |
| 474 factory_.Destroy(surface_id); | 498 factory_.Destroy(surface_id); |
| 475 } | 499 } |
| 476 | 500 |
| 477 } // namespace | 501 } // namespace |
| 478 } // namespace cc | 502 } // namespace cc |
| OLD | NEW |