OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 root_layer_(ContentLayer::Create(&client_)) {} | 278 root_layer_(ContentLayer::Create(&client_)) {} |
279 | 279 |
280 virtual void BeginTest() OVERRIDE { | 280 virtual void BeginTest() OVERRIDE { |
281 root_layer_->SetIsDrawable(true); | 281 root_layer_->SetIsDrawable(true); |
282 root_layer_->SetBounds(bounds_); | 282 root_layer_->SetBounds(bounds_); |
283 layer_tree_host()->SetRootLayer(root_layer_); | 283 layer_tree_host()->SetRootLayer(root_layer_); |
284 layer_tree_host()->SetViewportSize(bounds_); | 284 layer_tree_host()->SetViewportSize(bounds_); |
285 PostSetNeedsCommitToMainThread(); | 285 PostSetNeedsCommitToMainThread(); |
286 } | 286 } |
287 | 287 |
288 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 288 virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread( |
289 LayerTreeHostImpl::FrameData* frame_data, | 289 LayerTreeHostImpl* host_impl, |
290 bool result) OVERRIDE { | 290 LayerTreeHostImpl::FrameData* frame_data, |
291 EXPECT_TRUE(result); | 291 DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE { |
| 292 EXPECT_EQ(DrawSwapReadbackResult::DID_DRAW, draw_result); |
292 | 293 |
293 gfx::RectF root_damage_rect; | 294 gfx::RectF root_damage_rect; |
294 if (!frame_data->render_passes.empty()) | 295 if (!frame_data->render_passes.empty()) |
295 root_damage_rect = frame_data->render_passes.back()->damage_rect; | 296 root_damage_rect = frame_data->render_passes.back()->damage_rect; |
296 | 297 |
297 if (!num_draws_) { | 298 if (!num_draws_) { |
298 // If this is the first frame, expect full frame damage. | 299 // If this is the first frame, expect full frame damage. |
299 EXPECT_RECT_EQ(root_damage_rect, gfx::Rect(bounds_)); | 300 EXPECT_RECT_EQ(root_damage_rect, gfx::Rect(bounds_)); |
300 } else { | 301 } else { |
301 // Check that invalid_rect_ is indeed repainted. | 302 // Check that invalid_rect_ is indeed repainted. |
302 EXPECT_TRUE(root_damage_rect.Contains(invalid_rect_)); | 303 EXPECT_TRUE(root_damage_rect.Contains(invalid_rect_)); |
303 } | 304 } |
304 | 305 |
305 return result; | 306 return draw_result; |
306 } | 307 } |
307 | 308 |
308 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 309 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
309 if (!num_draws_) { | 310 if (!num_draws_) { |
310 PostSetNeedsRedrawRectToMainThread(invalid_rect_); | 311 PostSetNeedsRedrawRectToMainThread(invalid_rect_); |
311 } else { | 312 } else { |
312 EndTest(); | 313 EndTest(); |
313 } | 314 } |
314 num_draws_++; | 315 num_draws_++; |
315 } | 316 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 : did_post_readback_(false) {} | 510 : did_post_readback_(false) {} |
510 | 511 |
511 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 512 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
512 // This enables forced draws after a single prepare to draw failure. | 513 // This enables forced draws after a single prepare to draw failure. |
513 settings->timeout_and_draw_when_animation_checkerboards = true; | 514 settings->timeout_and_draw_when_animation_checkerboards = true; |
514 settings->maximum_number_of_failed_draws_before_draw_is_forced_ = 1; | 515 settings->maximum_number_of_failed_draws_before_draw_is_forced_ = 1; |
515 } | 516 } |
516 | 517 |
517 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 518 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
518 | 519 |
519 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 520 virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread( |
520 LayerTreeHostImpl::FrameData* frame_data, | 521 LayerTreeHostImpl* host_impl, |
521 bool result) OVERRIDE { | 522 LayerTreeHostImpl::FrameData* frame_data, |
| 523 DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE { |
522 int sfn = host_impl->active_tree()->source_frame_number(); | 524 int sfn = host_impl->active_tree()->source_frame_number(); |
523 EXPECT_TRUE(sfn == kFirstCommitSourceFrameNumber || | 525 EXPECT_TRUE(sfn == kFirstCommitSourceFrameNumber || |
524 sfn == kReadbackSourceFrameNumber || | 526 sfn == kReadbackSourceFrameNumber || |
525 sfn == kReadbackReplacementAndForcedDrawSourceFrameNumber) | 527 sfn == kReadbackReplacementAndForcedDrawSourceFrameNumber) |
526 << sfn; | 528 << sfn; |
527 | 529 |
528 // Before we react to the failed draw by initiating the forced draw | 530 // Before we react to the failed draw by initiating the forced draw |
529 // sequence, start a readback on the main thread. | 531 // sequence, start a readback on the main thread. |
530 if (sfn == kFirstCommitSourceFrameNumber && !did_post_readback_) { | 532 if (sfn == kFirstCommitSourceFrameNumber && !did_post_readback_) { |
531 did_post_readback_ = true; | 533 did_post_readback_ = true; |
532 PostReadbackToMainThread(); | 534 PostReadbackToMainThread(); |
533 } | 535 } |
534 | 536 |
535 // Returning false will result in a forced draw. | 537 // Returning false will result in a forced draw. |
536 return false; | 538 return DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS; |
537 } | 539 } |
538 | 540 |
539 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 541 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
540 // We should only draw for the readback and the forced draw. | 542 // We should only draw for the readback and the forced draw. |
541 int sfn = host_impl->active_tree()->source_frame_number(); | 543 int sfn = host_impl->active_tree()->source_frame_number(); |
542 EXPECT_TRUE(sfn == kReadbackSourceFrameNumber || | 544 EXPECT_TRUE(sfn == kReadbackSourceFrameNumber || |
543 sfn == kReadbackReplacementAndForcedDrawSourceFrameNumber) | 545 sfn == kReadbackReplacementAndForcedDrawSourceFrameNumber) |
544 << sfn; | 546 << sfn; |
545 } | 547 } |
546 | 548 |
(...skipping 22 matching lines...) Expand all Loading... |
569 static const int kReadbackReplacementSourceFrameNumber = 3; | 571 static const int kReadbackReplacementSourceFrameNumber = 3; |
570 | 572 |
571 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 573 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
572 // This enables forced draws after a single prepare to draw failure. | 574 // This enables forced draws after a single prepare to draw failure. |
573 settings->timeout_and_draw_when_animation_checkerboards = true; | 575 settings->timeout_and_draw_when_animation_checkerboards = true; |
574 settings->maximum_number_of_failed_draws_before_draw_is_forced_ = 1; | 576 settings->maximum_number_of_failed_draws_before_draw_is_forced_ = 1; |
575 } | 577 } |
576 | 578 |
577 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 579 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
578 | 580 |
579 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 581 virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread( |
580 LayerTreeHostImpl::FrameData* frame_data, | 582 LayerTreeHostImpl* host_impl, |
581 bool result) OVERRIDE { | 583 LayerTreeHostImpl::FrameData* frame_data, |
| 584 DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE { |
582 int sfn = host_impl->active_tree()->source_frame_number(); | 585 int sfn = host_impl->active_tree()->source_frame_number(); |
583 EXPECT_TRUE(sfn == kFirstCommitSourceFrameNumber || | 586 EXPECT_TRUE(sfn == kFirstCommitSourceFrameNumber || |
584 sfn == kForcedDrawSourceFrameNumber || | 587 sfn == kForcedDrawSourceFrameNumber || |
585 sfn == kReadbackSourceFrameNumber || | 588 sfn == kReadbackSourceFrameNumber || |
586 sfn == kReadbackReplacementSourceFrameNumber) | 589 sfn == kReadbackReplacementSourceFrameNumber) |
587 << sfn; | 590 << sfn; |
588 | 591 |
589 // Returning false will result in a forced draw. | 592 // Returning false will result in a forced draw. |
590 return false; | 593 return DrawSwapReadbackResult::DRAW_ABORTED_CHECKERBOARD_ANIMATIONS; |
591 } | 594 } |
592 | 595 |
593 virtual void DidCommit() OVERRIDE { | 596 virtual void DidCommit() OVERRIDE { |
594 if (layer_tree_host()->source_frame_number() == | 597 if (layer_tree_host()->source_frame_number() == |
595 kForcedDrawSourceFrameNumber) { | 598 kForcedDrawSourceFrameNumber) { |
596 // Avoid aborting the forced draw commit so source_frame_number | 599 // Avoid aborting the forced draw commit so source_frame_number |
597 // increments. | 600 // increments. |
598 layer_tree_host()->SetNeedsCommit(); | 601 layer_tree_host()->SetNeedsCommit(); |
599 } else if (layer_tree_host()->source_frame_number() == | 602 } else if (layer_tree_host()->source_frame_number() == |
600 kReadbackSourceFrameNumber) { | 603 kReadbackSourceFrameNumber) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 layer_tree_host()->SetRootLayer(root_layer_); | 648 layer_tree_host()->SetRootLayer(root_layer_); |
646 layer_tree_host()->SetViewportSize(bounds_); | 649 layer_tree_host()->SetViewportSize(bounds_); |
647 PostSetNeedsCommitToMainThread(); | 650 PostSetNeedsCommitToMainThread(); |
648 } | 651 } |
649 | 652 |
650 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 653 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
651 if (num_draws_ == 3 && host_impl->settings().impl_side_painting) | 654 if (num_draws_ == 3 && host_impl->settings().impl_side_painting) |
652 host_impl->SetNeedsRedrawRect(invalid_rect_); | 655 host_impl->SetNeedsRedrawRect(invalid_rect_); |
653 } | 656 } |
654 | 657 |
655 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 658 virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread( |
656 LayerTreeHostImpl::FrameData* frame_data, | 659 LayerTreeHostImpl* host_impl, |
657 bool result) OVERRIDE { | 660 LayerTreeHostImpl::FrameData* frame_data, |
658 EXPECT_TRUE(result); | 661 DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE { |
| 662 EXPECT_EQ(DrawSwapReadbackResult::DID_DRAW, draw_result); |
659 | 663 |
660 gfx::RectF root_damage_rect; | 664 gfx::RectF root_damage_rect; |
661 if (!frame_data->render_passes.empty()) | 665 if (!frame_data->render_passes.empty()) |
662 root_damage_rect = frame_data->render_passes.back()->damage_rect; | 666 root_damage_rect = frame_data->render_passes.back()->damage_rect; |
663 | 667 |
664 switch (num_draws_) { | 668 switch (num_draws_) { |
665 case 0: | 669 case 0: |
666 EXPECT_RECT_EQ(gfx::Rect(bounds_), root_damage_rect); | 670 EXPECT_RECT_EQ(gfx::Rect(bounds_), root_damage_rect); |
667 break; | 671 break; |
668 case 1: | 672 case 1: |
669 case 2: | 673 case 2: |
670 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root_damage_rect); | 674 EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root_damage_rect); |
671 break; | 675 break; |
672 case 3: | 676 case 3: |
673 EXPECT_RECT_EQ(invalid_rect_, root_damage_rect); | 677 EXPECT_RECT_EQ(invalid_rect_, root_damage_rect); |
674 break; | 678 break; |
675 case 4: | 679 case 4: |
676 EXPECT_RECT_EQ(gfx::Rect(bounds_), root_damage_rect); | 680 EXPECT_RECT_EQ(gfx::Rect(bounds_), root_damage_rect); |
677 break; | 681 break; |
678 default: | 682 default: |
679 NOTREACHED(); | 683 NOTREACHED(); |
680 } | 684 } |
681 | 685 |
682 return result; | 686 return draw_result; |
683 } | 687 } |
684 | 688 |
685 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 689 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
686 switch (num_draws_) { | 690 switch (num_draws_) { |
687 case 0: | 691 case 0: |
688 case 1: | 692 case 1: |
689 // Cycle through a couple of empty commits to ensure we're observing the | 693 // Cycle through a couple of empty commits to ensure we're observing the |
690 // right behavior | 694 // right behavior |
691 PostSetNeedsCommitToMainThread(); | 695 PostSetNeedsCommitToMainThread(); |
692 break; | 696 break; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 746 |
743 child_layer_ = FakeContentLayer::Create(&client_); | 747 child_layer_ = FakeContentLayer::Create(&client_); |
744 child_layer_->SetBounds(gfx::Size(25, 25)); | 748 child_layer_->SetBounds(gfx::Size(25, 25)); |
745 parent_layer_->AddChild(child_layer_); | 749 parent_layer_->AddChild(child_layer_); |
746 | 750 |
747 LayerTreeHostTest::SetupTree(); | 751 LayerTreeHostTest::SetupTree(); |
748 } | 752 } |
749 | 753 |
750 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 754 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
751 | 755 |
752 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 756 virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread( |
753 LayerTreeHostImpl::FrameData* frame_data, | 757 LayerTreeHostImpl* host_impl, |
754 bool result) OVERRIDE { | 758 LayerTreeHostImpl::FrameData* frame_data, |
755 EXPECT_TRUE(result); | 759 DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE { |
| 760 EXPECT_EQ(DrawSwapReadbackResult::DID_DRAW, draw_result); |
756 | 761 |
757 gfx::RectF root_damage_rect; | 762 gfx::RectF root_damage_rect; |
758 if (!frame_data->render_passes.empty()) | 763 if (!frame_data->render_passes.empty()) |
759 root_damage_rect = frame_data->render_passes.back()->damage_rect; | 764 root_damage_rect = frame_data->render_passes.back()->damage_rect; |
760 | 765 |
761 // The first time, the whole view needs be drawn. | 766 // The first time, the whole view needs be drawn. |
762 // Afterwards, just the opacity of surface_layer1 is changed a few times, | 767 // Afterwards, just the opacity of surface_layer1 is changed a few times, |
763 // and each damage should be the bounding box of it and its child. If this | 768 // and each damage should be the bounding box of it and its child. If this |
764 // was working improperly, the damage might not include its childs bounding | 769 // was working improperly, the damage might not include its childs bounding |
765 // box. | 770 // box. |
766 switch (layer_tree_host()->source_frame_number()) { | 771 switch (layer_tree_host()->source_frame_number()) { |
767 case 1: | 772 case 1: |
768 EXPECT_RECT_EQ(gfx::Rect(root_layer_->bounds()), root_damage_rect); | 773 EXPECT_RECT_EQ(gfx::Rect(root_layer_->bounds()), root_damage_rect); |
769 break; | 774 break; |
770 case 2: | 775 case 2: |
771 case 3: | 776 case 3: |
772 case 4: | 777 case 4: |
773 EXPECT_RECT_EQ(gfx::Rect(child_layer_->bounds()), root_damage_rect); | 778 EXPECT_RECT_EQ(gfx::Rect(child_layer_->bounds()), root_damage_rect); |
774 break; | 779 break; |
775 default: | 780 default: |
776 NOTREACHED(); | 781 NOTREACHED(); |
777 } | 782 } |
778 | 783 |
779 return result; | 784 return draw_result; |
780 } | 785 } |
781 | 786 |
782 virtual void DidCommitAndDrawFrame() OVERRIDE { | 787 virtual void DidCommitAndDrawFrame() OVERRIDE { |
783 switch (layer_tree_host()->source_frame_number()) { | 788 switch (layer_tree_host()->source_frame_number()) { |
784 case 1: | 789 case 1: |
785 // Test not owning the surface. | 790 // Test not owning the surface. |
786 parent_layer_->SetOpacity(1.0f); | 791 parent_layer_->SetOpacity(1.0f); |
787 break; | 792 break; |
788 case 2: | 793 case 2: |
789 parent_layer_->SetOpacity(0.0f); | 794 parent_layer_->SetOpacity(0.0f); |
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 2582 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
2578 settings->begin_impl_frame_scheduling_enabled = true; | 2583 settings->begin_impl_frame_scheduling_enabled = true; |
2579 } | 2584 } |
2580 | 2585 |
2581 virtual void BeginTest() OVERRIDE { | 2586 virtual void BeginTest() OVERRIDE { |
2582 // This will trigger a SetNeedsBeginImplFrame which will trigger a | 2587 // This will trigger a SetNeedsBeginImplFrame which will trigger a |
2583 // BeginImplFrame. | 2588 // BeginImplFrame. |
2584 PostSetNeedsCommitToMainThread(); | 2589 PostSetNeedsCommitToMainThread(); |
2585 } | 2590 } |
2586 | 2591 |
2587 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 2592 virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread( |
2588 LayerTreeHostImpl::FrameData* frame, | 2593 LayerTreeHostImpl* host_impl, |
2589 bool result) OVERRIDE { | 2594 LayerTreeHostImpl::FrameData* frame, |
| 2595 DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE { |
2590 EndTest(); | 2596 EndTest(); |
2591 return true; | 2597 return DrawSwapReadbackResult::DID_DRAW; |
2592 } | 2598 } |
2593 | 2599 |
2594 virtual void AfterTest() OVERRIDE {} | 2600 virtual void AfterTest() OVERRIDE {} |
2595 | 2601 |
2596 private: | 2602 private: |
2597 base::TimeTicks frame_time_; | 2603 base::TimeTicks frame_time_; |
2598 }; | 2604 }; |
2599 | 2605 |
2600 MULTI_THREAD_TEST_F(LayerTreeHostTestBeginImplFrameNotification); | 2606 MULTI_THREAD_TEST_F(LayerTreeHostTestBeginImplFrameNotification); |
2601 | 2607 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2864 EXPECT_CALL(*mock_context_, | 2870 EXPECT_CALL(*mock_context_, |
2865 texImageIOSurface2DCHROMIUM(GL_TEXTURE_RECTANGLE_ARB, | 2871 texImageIOSurface2DCHROMIUM(GL_TEXTURE_RECTANGLE_ARB, |
2866 io_surface_size_.width(), | 2872 io_surface_size_.width(), |
2867 io_surface_size_.height(), | 2873 io_surface_size_.height(), |
2868 io_surface_id_, | 2874 io_surface_id_, |
2869 0)).Times(1); | 2875 0)).Times(1); |
2870 | 2876 |
2871 EXPECT_CALL(*mock_context_, bindTexture(_, 0)).Times(AnyNumber()); | 2877 EXPECT_CALL(*mock_context_, bindTexture(_, 0)).Times(AnyNumber()); |
2872 } | 2878 } |
2873 | 2879 |
2874 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 2880 virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread( |
2875 LayerTreeHostImpl::FrameData* frame, | 2881 LayerTreeHostImpl* host_impl, |
2876 bool result) OVERRIDE { | 2882 LayerTreeHostImpl::FrameData* frame, |
| 2883 DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE { |
2877 Mock::VerifyAndClearExpectations(&mock_context_); | 2884 Mock::VerifyAndClearExpectations(&mock_context_); |
2878 | 2885 |
2879 // The io surface layer's texture is drawn. | 2886 // The io surface layer's texture is drawn. |
2880 EXPECT_CALL(*mock_context_, activeTexture(GL_TEXTURE0)).Times(AtLeast(1)); | 2887 EXPECT_CALL(*mock_context_, activeTexture(GL_TEXTURE0)).Times(AtLeast(1)); |
2881 EXPECT_CALL(*mock_context_, bindTexture(GL_TEXTURE_RECTANGLE_ARB, 1)) | 2888 EXPECT_CALL(*mock_context_, bindTexture(GL_TEXTURE_RECTANGLE_ARB, 1)) |
2882 .Times(1); | 2889 .Times(1); |
2883 EXPECT_CALL(*mock_context_, drawElements(GL_TRIANGLES, 6, _, _)) | 2890 EXPECT_CALL(*mock_context_, drawElements(GL_TRIANGLES, 6, _, _)) |
2884 .Times(AtLeast(1)); | 2891 .Times(AtLeast(1)); |
2885 | 2892 |
2886 return result; | 2893 return draw_result; |
2887 } | 2894 } |
2888 | 2895 |
2889 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 2896 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
2890 Mock::VerifyAndClearExpectations(&mock_context_); | 2897 Mock::VerifyAndClearExpectations(&mock_context_); |
2891 | 2898 |
2892 EXPECT_CALL(*mock_context_, deleteTexture(1)).Times(1); | 2899 EXPECT_CALL(*mock_context_, deleteTexture(1)).Times(1); |
2893 EndTest(); | 2900 EndTest(); |
2894 } | 2901 } |
2895 | 2902 |
2896 virtual void AfterTest() OVERRIDE {} | 2903 virtual void AfterTest() OVERRIDE {} |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4120 class LayerTreeHostTestTreeActivationCallback : public LayerTreeHostTest { | 4127 class LayerTreeHostTestTreeActivationCallback : public LayerTreeHostTest { |
4121 public: | 4128 public: |
4122 LayerTreeHostTestTreeActivationCallback() | 4129 LayerTreeHostTestTreeActivationCallback() |
4123 : num_commits_(0), callback_count_(0) {} | 4130 : num_commits_(0), callback_count_(0) {} |
4124 | 4131 |
4125 virtual void BeginTest() OVERRIDE { | 4132 virtual void BeginTest() OVERRIDE { |
4126 EXPECT_TRUE(HasImplThread()); | 4133 EXPECT_TRUE(HasImplThread()); |
4127 PostSetNeedsCommitToMainThread(); | 4134 PostSetNeedsCommitToMainThread(); |
4128 } | 4135 } |
4129 | 4136 |
4130 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 4137 virtual DrawSwapReadbackResult::DrawResult PrepareToDrawOnThread( |
4131 LayerTreeHostImpl::FrameData* frame_data, | 4138 LayerTreeHostImpl* host_impl, |
4132 bool result) OVERRIDE { | 4139 LayerTreeHostImpl::FrameData* frame_data, |
| 4140 DrawSwapReadbackResult::DrawResult draw_result) OVERRIDE { |
4133 ++num_commits_; | 4141 ++num_commits_; |
4134 switch (num_commits_) { | 4142 switch (num_commits_) { |
4135 case 1: | 4143 case 1: |
4136 EXPECT_EQ(0, callback_count_); | 4144 EXPECT_EQ(0, callback_count_); |
4137 callback_count_ = 0; | 4145 callback_count_ = 0; |
4138 SetCallback(true); | 4146 SetCallback(true); |
4139 PostSetNeedsCommitToMainThread(); | 4147 PostSetNeedsCommitToMainThread(); |
4140 break; | 4148 break; |
4141 case 2: | 4149 case 2: |
4142 EXPECT_EQ(1, callback_count_); | 4150 EXPECT_EQ(1, callback_count_); |
4143 callback_count_ = 0; | 4151 callback_count_ = 0; |
4144 SetCallback(false); | 4152 SetCallback(false); |
4145 PostSetNeedsCommitToMainThread(); | 4153 PostSetNeedsCommitToMainThread(); |
4146 break; | 4154 break; |
4147 case 3: | 4155 case 3: |
4148 EXPECT_EQ(0, callback_count_); | 4156 EXPECT_EQ(0, callback_count_); |
4149 callback_count_ = 0; | 4157 callback_count_ = 0; |
4150 EndTest(); | 4158 EndTest(); |
4151 break; | 4159 break; |
4152 default: | 4160 default: |
4153 ADD_FAILURE() << num_commits_; | 4161 ADD_FAILURE() << num_commits_; |
4154 EndTest(); | 4162 EndTest(); |
4155 break; | 4163 break; |
4156 } | 4164 } |
4157 return LayerTreeHostTest::PrepareToDrawOnThread( | 4165 return LayerTreeHostTest::PrepareToDrawOnThread( |
4158 host_impl, frame_data, result); | 4166 host_impl, frame_data, draw_result); |
4159 } | 4167 } |
4160 | 4168 |
4161 virtual void AfterTest() OVERRIDE { EXPECT_EQ(3, num_commits_); } | 4169 virtual void AfterTest() OVERRIDE { EXPECT_EQ(3, num_commits_); } |
4162 | 4170 |
4163 void SetCallback(bool enable) { | 4171 void SetCallback(bool enable) { |
4164 output_surface()->SetTreeActivationCallback( | 4172 output_surface()->SetTreeActivationCallback( |
4165 enable | 4173 enable |
4166 ? base::Bind( | 4174 ? base::Bind( |
4167 &LayerTreeHostTestTreeActivationCallback::ActivationCallback, | 4175 &LayerTreeHostTestTreeActivationCallback::ActivationCallback, |
4168 base::Unretained(this)) | 4176 base::Unretained(this)) |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4949 | 4957 |
4950 EndTest(); | 4958 EndTest(); |
4951 } | 4959 } |
4952 | 4960 |
4953 virtual void AfterTest() OVERRIDE {} | 4961 virtual void AfterTest() OVERRIDE {} |
4954 }; | 4962 }; |
4955 | 4963 |
4956 MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); | 4964 MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); |
4957 | 4965 |
4958 } // namespace cc | 4966 } // namespace cc |
OLD | NEW |