Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 563523002: cc: Change LayerTreeHost unit tests to use impl painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 int num_draws_; 410 int num_draws_;
411 }; 411 };
412 412
413 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedraw); 413 MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedraw);
414 414
415 // After setNeedsRedrawRect(invalid_rect) the final damage_rect 415 // After setNeedsRedrawRect(invalid_rect) the final damage_rect
416 // must contain invalid_rect. 416 // must contain invalid_rect.
417 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest { 417 class LayerTreeHostTestSetNeedsRedrawRect : public LayerTreeHostTest {
418 public: 418 public:
419 LayerTreeHostTestSetNeedsRedrawRect() 419 LayerTreeHostTestSetNeedsRedrawRect()
420 : num_draws_(0), 420 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
421 bounds_(50, 50),
422 invalid_rect_(10, 10, 20, 20),
423 root_layer_(ContentLayer::Create(&client_)) {}
424 421
425 void BeginTest() override { 422 void BeginTest() override {
423 if (layer_tree_host()->settings().impl_side_painting)
424 root_layer_ = FakePictureLayer::Create(&client_);
425 else
426 root_layer_ = ContentLayer::Create(&client_);
426 root_layer_->SetIsDrawable(true); 427 root_layer_->SetIsDrawable(true);
427 root_layer_->SetBounds(bounds_); 428 root_layer_->SetBounds(bounds_);
428 layer_tree_host()->SetRootLayer(root_layer_); 429 layer_tree_host()->SetRootLayer(root_layer_);
429 layer_tree_host()->SetViewportSize(bounds_); 430 layer_tree_host()->SetViewportSize(bounds_);
430 PostSetNeedsCommitToMainThread(); 431 PostSetNeedsCommitToMainThread();
431 } 432 }
432 433
433 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 434 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
434 LayerTreeHostImpl::FrameData* frame_data, 435 LayerTreeHostImpl::FrameData* frame_data,
435 DrawResult draw_result) override { 436 DrawResult draw_result) override {
(...skipping 23 matching lines...) Expand all
459 num_draws_++; 460 num_draws_++;
460 } 461 }
461 462
462 void AfterTest() override { EXPECT_EQ(2, num_draws_); } 463 void AfterTest() override { EXPECT_EQ(2, num_draws_); }
463 464
464 private: 465 private:
465 int num_draws_; 466 int num_draws_;
466 const gfx::Size bounds_; 467 const gfx::Size bounds_;
467 const gfx::Rect invalid_rect_; 468 const gfx::Rect invalid_rect_;
468 FakeContentLayerClient client_; 469 FakeContentLayerClient client_;
469 scoped_refptr<ContentLayer> root_layer_; 470 scoped_refptr<Layer> root_layer_;
470 }; 471 };
471 472
472 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedrawRect); 473 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsRedrawRect);
473 474
474 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { 475 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
475 public: 476 public:
476 void InitializeSettings(LayerTreeSettings* settings) override { 477 void InitializeSettings(LayerTreeSettings* settings) override {
477 settings->layer_transforms_should_scale_layer_contents = true; 478 settings->layer_transforms_should_scale_layer_contents = true;
478 } 479 }
479 480
480 void SetupTree() override { 481 void SetupTree() override {
481 root_layer_ = Layer::Create(); 482 root_layer_ = Layer::Create();
482 root_layer_->SetBounds(gfx::Size(10, 20)); 483 root_layer_->SetBounds(gfx::Size(10, 20));
483 484
484 scaled_layer_ = FakeContentLayer::Create(&client_); 485 if (layer_tree_host()->settings().impl_side_painting)
486 scaled_layer_ = FakePictureLayer::Create(&client_);
487 else
488 scaled_layer_ = FakeContentLayer::Create(&client_);
485 scaled_layer_->SetBounds(gfx::Size(1, 1)); 489 scaled_layer_->SetBounds(gfx::Size(1, 1));
486 root_layer_->AddChild(scaled_layer_); 490 root_layer_->AddChild(scaled_layer_);
487 491
488 layer_tree_host()->SetRootLayer(root_layer_); 492 layer_tree_host()->SetRootLayer(root_layer_);
489 LayerTreeHostTest::SetupTree(); 493 LayerTreeHostTest::SetupTree();
490 } 494 }
491 495
492 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 496 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
493 497
494 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 498 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
495 if (host_impl->active_tree()->source_frame_number() == 1) 499 if (host_impl->active_tree()->source_frame_number() == 1)
496 EndTest(); 500 EndTest();
497 } 501 }
498 502
499 void DidCommit() override { 503 void DidCommit() override {
500 switch (layer_tree_host()->source_frame_number()) { 504 switch (layer_tree_host()->source_frame_number()) {
501 case 1: 505 case 1:
502 // Changing the device scale factor causes a commit. It also changes 506 // SetBounds grows the layer and exposes new content.
503 // the content bounds of |scaled_layer_|, which should not generate 507 if (layer_tree_host()->settings().impl_side_painting) {
504 // a second commit as a result. 508 scaled_layer_->SetBounds(gfx::Size(4, 4));
505 layer_tree_host()->SetDeviceScaleFactor(4.f); 509 } else {
510 // Changing the device scale factor causes a commit. It also changes
511 // the content bounds of |scaled_layer_|, which should not generate
512 // a second commit as a result.
513 layer_tree_host()->SetDeviceScaleFactor(4.f);
514 }
506 break; 515 break;
507 default: 516 default:
508 // No extra commits. 517 // No extra commits.
509 EXPECT_EQ(2, layer_tree_host()->source_frame_number()); 518 EXPECT_EQ(2, layer_tree_host()->source_frame_number());
510 } 519 }
511 } 520 }
512 521
513 void AfterTest() override { 522 void AfterTest() override {
514 EXPECT_EQ(gfx::Size(4, 4).ToString(), 523 EXPECT_EQ(gfx::Size(4, 4).ToString(),
515 scaled_layer_->content_bounds().ToString()); 524 scaled_layer_->content_bounds().ToString());
516 } 525 }
517 526
518 private: 527 private:
519 FakeContentLayerClient client_; 528 FakeContentLayerClient client_;
520 scoped_refptr<Layer> root_layer_; 529 scoped_refptr<Layer> root_layer_;
521 scoped_refptr<FakeContentLayer> scaled_layer_; 530 scoped_refptr<Layer> scaled_layer_;
522 }; 531 };
523 532
524 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate); 533 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate);
525 534
526 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate 535 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate
527 : public LayerTreeHostTest { 536 : public LayerTreeHostTest {
528 public: 537 public:
529 void InitializeSettings(LayerTreeSettings* settings) override { 538 void InitializeSettings(LayerTreeSettings* settings) override {
530 settings->layer_transforms_should_scale_layer_contents = true; 539 settings->layer_transforms_should_scale_layer_contents = true;
531 } 540 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 scoped_refptr<Layer> root_layer_; 587 scoped_refptr<Layer> root_layer_;
579 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_; 588 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_;
580 }; 589 };
581 590
582 SINGLE_AND_MULTI_THREAD_TEST_F( 591 SINGLE_AND_MULTI_THREAD_TEST_F(
583 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate); 592 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate);
584 593
585 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { 594 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest {
586 public: 595 public:
587 LayerTreeHostTestSetNextCommitForcesRedraw() 596 LayerTreeHostTestSetNextCommitForcesRedraw()
588 : num_draws_(0), 597 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
589 bounds_(50, 50),
590 invalid_rect_(10, 10, 20, 20),
591 root_layer_(ContentLayer::Create(&client_)) {}
592 598
593 void BeginTest() override { 599 void BeginTest() override {
600 if (layer_tree_host()->settings().impl_side_painting)
601 root_layer_ = FakePictureLayer::Create(&client_);
602 else
603 root_layer_ = ContentLayer::Create(&client_);
594 root_layer_->SetIsDrawable(true); 604 root_layer_->SetIsDrawable(true);
595 root_layer_->SetBounds(bounds_); 605 root_layer_->SetBounds(bounds_);
596 layer_tree_host()->SetRootLayer(root_layer_); 606 layer_tree_host()->SetRootLayer(root_layer_);
597 layer_tree_host()->SetViewportSize(bounds_); 607 layer_tree_host()->SetViewportSize(bounds_);
598 PostSetNeedsCommitToMainThread(); 608 PostSetNeedsCommitToMainThread();
599 } 609 }
600 610
601 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 611 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
602 if (num_draws_ == 3 && host_impl->settings().impl_side_painting) 612 if (num_draws_ == 3 && host_impl->settings().impl_side_painting)
603 host_impl->SetNeedsRedrawRect(invalid_rect_); 613 host_impl->SetNeedsRedrawRect(invalid_rect_);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 num_draws_++; 670 num_draws_++;
661 } 671 }
662 672
663 void AfterTest() override { EXPECT_EQ(5, num_draws_); } 673 void AfterTest() override { EXPECT_EQ(5, num_draws_); }
664 674
665 private: 675 private:
666 int num_draws_; 676 int num_draws_;
667 const gfx::Size bounds_; 677 const gfx::Size bounds_;
668 const gfx::Rect invalid_rect_; 678 const gfx::Rect invalid_rect_;
669 FakeContentLayerClient client_; 679 FakeContentLayerClient client_;
670 scoped_refptr<ContentLayer> root_layer_; 680 scoped_refptr<Layer> root_layer_;
671 }; 681 };
672 682
673 SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F( 683 SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(
674 LayerTreeHostTestSetNextCommitForcesRedraw); 684 LayerTreeHostTestSetNextCommitForcesRedraw);
675 685
676 // Tests that if a layer is not drawn because of some reason in the parent then 686 // Tests that if a layer is not drawn because of some reason in the parent then
677 // its damage is preserved until the next time it is drawn. 687 // its damage is preserved until the next time it is drawn.
678 class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest { 688 class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest {
679 public: 689 public:
680 LayerTreeHostTestUndrawnLayersDamageLater() 690 LayerTreeHostTestUndrawnLayersDamageLater() {}
681 : root_layer_(ContentLayer::Create(&client_)) {}
682 691
683 void SetupTree() override { 692 void SetupTree() override {
693 if (layer_tree_host()->settings().impl_side_painting)
694 root_layer_ = FakePictureLayer::Create(&client_);
695 else
696 root_layer_ = ContentLayer::Create(&client_);
684 root_layer_->SetIsDrawable(true); 697 root_layer_->SetIsDrawable(true);
685 root_layer_->SetBounds(gfx::Size(50, 50)); 698 root_layer_->SetBounds(gfx::Size(50, 50));
686 layer_tree_host()->SetRootLayer(root_layer_); 699 layer_tree_host()->SetRootLayer(root_layer_);
687 700
688 // The initially transparent layer has a larger child layer, which is 701 // The initially transparent layer has a larger child layer, which is
689 // not initially drawn because of the this (parent) layer. 702 // not initially drawn because of the this (parent) layer.
690 parent_layer_ = FakeContentLayer::Create(&client_); 703 if (layer_tree_host()->settings().impl_side_painting)
704 parent_layer_ = FakePictureLayer::Create(&client_);
705 else
706 parent_layer_ = FakeContentLayer::Create(&client_);
691 parent_layer_->SetBounds(gfx::Size(15, 15)); 707 parent_layer_->SetBounds(gfx::Size(15, 15));
692 parent_layer_->SetOpacity(0.0f); 708 parent_layer_->SetOpacity(0.0f);
693 root_layer_->AddChild(parent_layer_); 709 root_layer_->AddChild(parent_layer_);
694 710
695 child_layer_ = FakeContentLayer::Create(&client_); 711 if (layer_tree_host()->settings().impl_side_painting)
712 child_layer_ = FakePictureLayer::Create(&client_);
713 else
714 child_layer_ = FakeContentLayer::Create(&client_);
696 child_layer_->SetBounds(gfx::Size(25, 25)); 715 child_layer_->SetBounds(gfx::Size(25, 25));
697 parent_layer_->AddChild(child_layer_); 716 parent_layer_->AddChild(child_layer_);
698 717
699 LayerTreeHostTest::SetupTree(); 718 LayerTreeHostTest::SetupTree();
700 } 719 }
701 720
702 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 721 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
703 722
704 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 723 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
705 LayerTreeHostImpl::FrameData* frame_data, 724 LayerTreeHostImpl::FrameData* frame_data,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 break; 769 break;
751 default: 770 default:
752 NOTREACHED(); 771 NOTREACHED();
753 } 772 }
754 } 773 }
755 774
756 void AfterTest() override {} 775 void AfterTest() override {}
757 776
758 private: 777 private:
759 FakeContentLayerClient client_; 778 FakeContentLayerClient client_;
760 scoped_refptr<ContentLayer> root_layer_; 779 scoped_refptr<Layer> root_layer_;
761 scoped_refptr<FakeContentLayer> parent_layer_; 780 scoped_refptr<Layer> parent_layer_;
762 scoped_refptr<FakeContentLayer> child_layer_; 781 scoped_refptr<Layer> child_layer_;
763 }; 782 };
764 783
765 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUndrawnLayersDamageLater); 784 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUndrawnLayersDamageLater);
766 785
767 // Tests that if a layer is not drawn because of some reason in the parent, 786 // Tests that if a layer is not drawn because of some reason in the parent,
768 // causing its content bounds to not be computed, then when it is later drawn, 787 // causing its content bounds to not be computed, then when it is later drawn,
769 // its content bounds get pushed. 788 // its content bounds get pushed.
770 class LayerTreeHostTestUndrawnLayersPushContentBoundsLater 789 class LayerTreeHostTestUndrawnLayersPushContentBoundsLater
771 : public LayerTreeHostTest { 790 : public LayerTreeHostTest {
772 public: 791 public:
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 } 1144 }
1126 ~ContentLayerWithUpdateTracking() override {} 1145 ~ContentLayerWithUpdateTracking() override {}
1127 1146
1128 int paint_contents_count_; 1147 int paint_contents_count_;
1129 }; 1148 };
1130 1149
1131 // Layer opacity change during paint should not prevent compositor resources 1150 // Layer opacity change during paint should not prevent compositor resources
1132 // from being updated during commit. 1151 // from being updated during commit.
1133 class LayerTreeHostTestOpacityChange : public LayerTreeHostTest { 1152 class LayerTreeHostTestOpacityChange : public LayerTreeHostTest {
1134 public: 1153 public:
1135 LayerTreeHostTestOpacityChange() 1154 LayerTreeHostTestOpacityChange() : test_opacity_change_delegate_() {}
1136 : test_opacity_change_delegate_(),
1137 update_check_layer_(ContentLayerWithUpdateTracking::Create(
1138 &test_opacity_change_delegate_)) {
1139 test_opacity_change_delegate_.SetTestLayer(update_check_layer_.get());
1140 }
1141 1155
1142 void BeginTest() override { 1156 void BeginTest() override {
1157 if (layer_tree_host()->settings().impl_side_painting) {
1158 update_check_picture_layer_ =
1159 FakePictureLayer::Create(&test_opacity_change_delegate_);
1160 test_opacity_change_delegate_.SetTestLayer(
1161 update_check_picture_layer_.get());
1162 is_impl_paint_ = true;
1163 } else {
1164 update_check_content_layer_ = ContentLayerWithUpdateTracking::Create(
1165 &test_opacity_change_delegate_);
1166 test_opacity_change_delegate_.SetTestLayer(
1167 update_check_content_layer_.get());
1168 is_impl_paint_ = false;
1169 }
1143 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); 1170 layer_tree_host()->SetViewportSize(gfx::Size(10, 10));
1144 layer_tree_host()->root_layer()->AddChild(update_check_layer_); 1171 if (layer_tree_host()->settings().impl_side_painting)
1172 layer_tree_host()->root_layer()->AddChild(update_check_picture_layer_);
1173 else
1174 layer_tree_host()->root_layer()->AddChild(update_check_content_layer_);
1145 1175
1146 PostSetNeedsCommitToMainThread(); 1176 PostSetNeedsCommitToMainThread();
1147 } 1177 }
1148 1178
1149 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { EndTest(); } 1179 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { EndTest(); }
1150 1180
1151 void AfterTest() override { 1181 void AfterTest() override {
1152 // Update() should have been called once. 1182 // Update() should have been called once.
1153 EXPECT_EQ(1, update_check_layer_->PaintContentsCount()); 1183 if (is_impl_paint_)
1184 EXPECT_EQ(1u, update_check_picture_layer_->update_count());
1185 else
1186 EXPECT_EQ(1, update_check_content_layer_->PaintContentsCount());
1154 } 1187 }
1155 1188
1156 private: 1189 private:
1157 TestOpacityChangeLayerDelegate test_opacity_change_delegate_; 1190 TestOpacityChangeLayerDelegate test_opacity_change_delegate_;
1158 scoped_refptr<ContentLayerWithUpdateTracking> update_check_layer_; 1191 scoped_refptr<ContentLayerWithUpdateTracking> update_check_content_layer_;
1192 scoped_refptr<FakePictureLayer> update_check_picture_layer_;
1193 bool is_impl_paint_;
1159 }; 1194 };
1160 1195
1161 MULTI_THREAD_TEST_F(LayerTreeHostTestOpacityChange); 1196 MULTI_THREAD_TEST_F(LayerTreeHostTestOpacityChange);
1162 1197
1163 class NoScaleContentLayer : public ContentLayer {
1164 public:
1165 static scoped_refptr<NoScaleContentLayer> Create(ContentLayerClient* client) {
1166 return make_scoped_refptr(new NoScaleContentLayer(client));
1167 }
1168
1169 void CalculateContentsScale(float ideal_contents_scale,
1170 float* contents_scale_x,
1171 float* contents_scale_y,
1172 gfx::Size* contentBounds) override {
1173 // Skip over the ContentLayer's method to the base Layer class.
1174 Layer::CalculateContentsScale(ideal_contents_scale,
1175 contents_scale_x,
1176 contents_scale_y,
1177 contentBounds);
1178 }
1179
1180 private:
1181 explicit NoScaleContentLayer(ContentLayerClient* client)
1182 : ContentLayer(client) {}
1183 ~NoScaleContentLayer() override {}
1184 };
1185
1186 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers 1198 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers
1187 : public LayerTreeHostTest { 1199 : public LayerTreeHostTest {
1188 public: 1200 public:
1189 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() 1201 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {}
1190 : root_layer_(NoScaleContentLayer::Create(&client_)), 1202
1191 child_layer_(ContentLayer::Create(&client_)) {} 1203 void InitializeSettings(LayerTreeSettings* settings) override {
1204 // PictureLayer can only be used with impl side painting enabled.
1205 settings->impl_side_painting = true;
1206 }
1192 1207
1193 void BeginTest() override { 1208 void BeginTest() override {
1209 // Paint non-solid color.
danakj 2014/11/13 18:14:22 drop this comment
1210 client_.set_fill_with_nonsolid_color(true);
1211 root_layer_ = FakePictureLayer::Create(&client_);
1212 child_layer_ = FakePictureLayer::Create(&client_);
1213
1194 layer_tree_host()->SetViewportSize(gfx::Size(60, 60)); 1214 layer_tree_host()->SetViewportSize(gfx::Size(60, 60));
1195 layer_tree_host()->SetDeviceScaleFactor(1.5); 1215 layer_tree_host()->SetDeviceScaleFactor(1.5);
1196 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); 1216 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size());
1197 1217
1198 root_layer_->AddChild(child_layer_); 1218 root_layer_->AddChild(child_layer_);
1199 1219
1200 root_layer_->SetIsDrawable(true); 1220 root_layer_->SetIsDrawable(true);
1201 root_layer_->SetBounds(gfx::Size(30, 30)); 1221 root_layer_->SetBounds(gfx::Size(30, 30));
1202 1222
1203 child_layer_->SetIsDrawable(true); 1223 child_layer_->SetIsDrawable(true);
(...skipping 10 matching lines...) Expand all
1214 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); 1234 EXPECT_EQ(0, impl->active_tree()->source_frame_number());
1215 // Device scale factor should come over to impl. 1235 // Device scale factor should come over to impl.
1216 EXPECT_NEAR(impl->device_scale_factor(), 1.5f, 0.00001f); 1236 EXPECT_NEAR(impl->device_scale_factor(), 1.5f, 0.00001f);
1217 1237
1218 // Both layers are on impl. 1238 // Both layers are on impl.
1219 ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size()); 1239 ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size());
1220 1240
1221 // Device viewport is scaled. 1241 // Device viewport is scaled.
1222 EXPECT_EQ(gfx::Size(60, 60), impl->DrawViewportSize()); 1242 EXPECT_EQ(gfx::Size(60, 60), impl->DrawViewportSize());
1223 1243
1224 LayerImpl* root = impl->active_tree()->root_layer(); 1244 FakePictureLayerImpl* root =
1225 LayerImpl* child = impl->active_tree()->root_layer()->children()[0]; 1245 static_cast<FakePictureLayerImpl*>(impl->active_tree()->root_layer());
1246 FakePictureLayerImpl* child = static_cast<FakePictureLayerImpl*>(
1247 impl->active_tree()->root_layer()->children()[0]);
1226 1248
1227 // Positions remain in layout pixels. 1249 // Positions remain in layout pixels.
1228 EXPECT_EQ(gfx::Point(0, 0), root->position()); 1250 EXPECT_EQ(gfx::Point(0, 0), root->position());
1229 EXPECT_EQ(gfx::Point(2, 2), child->position()); 1251 EXPECT_EQ(gfx::Point(2, 2), child->position());
1230 1252
1231 // Compute all the layer transforms for the frame. 1253 // Compute all the layer transforms for the frame.
1232 LayerTreeHostImpl::FrameData frame_data; 1254 LayerTreeHostImpl::FrameData frame_data;
1233 impl->PrepareToDraw(&frame_data); 1255 impl->PrepareToDraw(&frame_data);
1234 impl->DidDrawAllLayers(frame_data); 1256 impl->DidDrawAllLayers(frame_data);
1235 1257
1236 const LayerImplList& render_surface_layer_list = 1258 const LayerImplList& render_surface_layer_list =
1237 *frame_data.render_surface_layer_list; 1259 *frame_data.render_surface_layer_list;
1238 1260
1239 // Both layers should be drawing into the root render surface. 1261 // Both layers should be drawing into the root render surface.
1240 ASSERT_EQ(1u, render_surface_layer_list.size()); 1262 ASSERT_EQ(1u, render_surface_layer_list.size());
1241 ASSERT_EQ(root->render_surface(), 1263 ASSERT_EQ(root->render_surface(),
1242 render_surface_layer_list[0]->render_surface()); 1264 render_surface_layer_list[0]->render_surface());
1243 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); 1265 ASSERT_EQ(2u, root->render_surface()->layer_list().size());
1244 1266
1245 // The root render surface is the size of the viewport. 1267 // The root render surface is the size of the viewport.
1246 EXPECT_RECT_EQ(gfx::Rect(0, 0, 60, 60), 1268 EXPECT_RECT_EQ(gfx::Rect(0, 0, 60, 60),
1247 root->render_surface()->content_rect()); 1269 root->render_surface()->content_rect());
1248 1270
1249 // The content bounds of the child should be scaled. 1271 // The max tiling scale of the child should be scaled.
1250 gfx::Size child_bounds_scaled = 1272 EXPECT_FLOAT_EQ(1.5f, child->MaximumTilingContentsScale());
1251 gfx::ToCeiledSize(gfx::ScaleSize(child->bounds(), 1.5));
1252 EXPECT_EQ(child_bounds_scaled, child->content_bounds());
1253 1273
1254 gfx::Transform scale_transform; 1274 gfx::Transform scale_transform;
1255 scale_transform.Scale(impl->device_scale_factor(), 1275 scale_transform.Scale(impl->device_scale_factor(),
1256 impl->device_scale_factor()); 1276 impl->device_scale_factor());
1257 1277
1258 // The root layer is scaled by 2x. 1278 // The root layer is scaled by 2x.
1259 gfx::Transform root_screen_space_transform = scale_transform; 1279 gfx::Transform root_screen_space_transform = scale_transform;
1260 gfx::Transform root_draw_transform = scale_transform; 1280 gfx::Transform root_draw_transform = scale_transform;
1261 1281
1262 EXPECT_EQ(root_draw_transform, root->draw_transform()); 1282 EXPECT_EQ(root_draw_transform, root->draw_transform());
1263 EXPECT_EQ(root_screen_space_transform, root->screen_space_transform()); 1283 EXPECT_EQ(root_screen_space_transform, root->screen_space_transform());
1264 1284
1265 // The child is at position 2,2, which is transformed to 3,3 after the scale 1285 // The child is at position 2,2, which is transformed to 3,3 after the scale
1266 gfx::Transform child_screen_space_transform; 1286 gfx::Transform child_transform;
1267 child_screen_space_transform.Translate(3.f, 3.f); 1287 child_transform.Translate(3.f, 3.f);
1268 gfx::Transform child_draw_transform = child_screen_space_transform; 1288 child_transform.Scale(child->MaximumTilingContentsScale(),
1289 child->MaximumTilingContentsScale());
1269 1290
1270 EXPECT_TRANSFORMATION_MATRIX_EQ(child_draw_transform, 1291 EXPECT_TRANSFORMATION_MATRIX_EQ(child_transform, child->draw_transform());
1271 child->draw_transform()); 1292 EXPECT_TRANSFORMATION_MATRIX_EQ(child_transform,
1272 EXPECT_TRANSFORMATION_MATRIX_EQ(child_screen_space_transform,
1273 child->screen_space_transform()); 1293 child->screen_space_transform());
1274 1294
1275 EndTest(); 1295 EndTest();
1276 } 1296 }
1277 1297
1278 void AfterTest() override {} 1298 void AfterTest() override {}
1279 1299
1280 private: 1300 private:
1281 FakeContentLayerClient client_; 1301 FakeContentLayerClient client_;
1282 scoped_refptr<NoScaleContentLayer> root_layer_; 1302 scoped_refptr<FakePictureLayer> root_layer_;
1283 scoped_refptr<ContentLayer> child_layer_; 1303 scoped_refptr<FakePictureLayer> child_layer_;
1284 }; 1304 };
1285 1305
1286 MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers); 1306 MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers);
1287 1307
1308 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere.
1288 // Verify atomicity of commits and reuse of textures. 1309 // Verify atomicity of commits and reuse of textures.
1289 class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest { 1310 class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest {
1290 public: 1311 public:
1291 void InitializeSettings(LayerTreeSettings* settings) override { 1312 void InitializeSettings(LayerTreeSettings* settings) override {
1292 settings->texture_id_allocation_chunk_size = 1; 1313 settings->texture_id_allocation_chunk_size = 1;
1293 // Make sure partial texture updates are turned off. 1314 // Make sure partial texture updates are turned off.
1294 settings->max_partial_texture_updates = 0; 1315 settings->max_partial_texture_updates = 0;
1295 // Linear fade animator prevents scrollbars from drawing immediately. 1316 // Linear fade animator prevents scrollbars from drawing immediately.
1296 settings->scrollbar_animator = LayerTreeSettings::NoAnimator; 1317 settings->scrollbar_animator = LayerTreeSettings::NoAnimator;
1297 } 1318 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 protected: 1407 protected:
1387 FakeContentLayerClient client_; 1408 FakeContentLayerClient client_;
1388 scoped_refptr<FakeContentLayer> layer_; 1409 scoped_refptr<FakeContentLayer> layer_;
1389 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_; 1410 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_;
1390 int drew_frame_; 1411 int drew_frame_;
1391 }; 1412 };
1392 1413
1393 MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F( 1414 MULTI_THREAD_DIRECT_RENDERER_NOIMPL_TEST_F(
1394 LayerTreeHostTestDirectRendererAtomicCommit); 1415 LayerTreeHostTestDirectRendererAtomicCommit);
1395 1416
1417 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere.
1396 class LayerTreeHostTestDelegatingRendererAtomicCommit 1418 class LayerTreeHostTestDelegatingRendererAtomicCommit
1397 : public LayerTreeHostTestDirectRendererAtomicCommit { 1419 : public LayerTreeHostTestDirectRendererAtomicCommit {
1398 public: 1420 public:
1399 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { 1421 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
1400 ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates); 1422 ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates);
1401 1423
1402 TestWebGraphicsContext3D* context = TestContext(); 1424 TestWebGraphicsContext3D* context = TestContext();
1403 1425
1404 switch (impl->active_tree()->source_frame_number()) { 1426 switch (impl->active_tree()->source_frame_number()) {
1405 case 0: 1427 case 0:
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 layer->RemoveAllChildren(); 1475 layer->RemoveAllChildren();
1454 if (parent) 1476 if (parent)
1455 parent->AddChild(layer); 1477 parent->AddChild(layer);
1456 layer->SetTransform(transform); 1478 layer->SetTransform(transform);
1457 layer->SetTransformOrigin(transform_origin); 1479 layer->SetTransformOrigin(transform_origin);
1458 layer->SetPosition(position); 1480 layer->SetPosition(position);
1459 layer->SetBounds(bounds); 1481 layer->SetBounds(bounds);
1460 layer->SetContentsOpaque(opaque); 1482 layer->SetContentsOpaque(opaque);
1461 } 1483 }
1462 1484
1485 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere.
1463 class LayerTreeHostTestAtomicCommitWithPartialUpdate 1486 class LayerTreeHostTestAtomicCommitWithPartialUpdate
1464 : public LayerTreeHostTest { 1487 : public LayerTreeHostTest {
1465 public: 1488 public:
1466 void InitializeSettings(LayerTreeSettings* settings) override { 1489 void InitializeSettings(LayerTreeSettings* settings) override {
1467 settings->texture_id_allocation_chunk_size = 1; 1490 settings->texture_id_allocation_chunk_size = 1;
1468 // Allow one partial texture update. 1491 // Allow one partial texture update.
1469 settings->max_partial_texture_updates = 1; 1492 settings->max_partial_texture_updates = 1;
1470 // No partial updates when impl side painting is enabled. 1493 // No partial updates when impl side painting is enabled.
1471 settings->impl_side_painting = false; 1494 settings->impl_side_painting = false;
1472 } 1495 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 private: 1649 private:
1627 FakeContentLayerClient client_; 1650 FakeContentLayerClient client_;
1628 scoped_refptr<FakeContentLayer> parent_; 1651 scoped_refptr<FakeContentLayer> parent_;
1629 scoped_refptr<FakeContentLayer> child_; 1652 scoped_refptr<FakeContentLayer> child_;
1630 }; 1653 };
1631 1654
1632 // Partial updates are not possible with a delegating renderer. 1655 // Partial updates are not possible with a delegating renderer.
1633 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 1656 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
1634 LayerTreeHostTestAtomicCommitWithPartialUpdate); 1657 LayerTreeHostTestAtomicCommitWithPartialUpdate);
1635 1658
1659 // TODO(sohanjg) : Make it work with impl-side painting.
1636 class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit 1660 class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
1637 : public LayerTreeHostTest { 1661 : public LayerTreeHostTest {
1638 protected: 1662 protected:
1639 void SetupTree() override { 1663 void SetupTree() override {
1640 root_layer_ = FakeContentLayer::Create(&client_); 1664 root_layer_ = FakeContentLayer::Create(&client_);
1641 root_layer_->SetBounds(gfx::Size(100, 100)); 1665 root_layer_->SetBounds(gfx::Size(100, 100));
1642 1666
1643 surface_layer1_ = FakeContentLayer::Create(&client_); 1667 surface_layer1_ = FakeContentLayer::Create(&client_);
1644 surface_layer1_->SetBounds(gfx::Size(100, 100)); 1668 surface_layer1_->SetBounds(gfx::Size(100, 100));
1645 surface_layer1_->SetForceRenderSurface(true); 1669 surface_layer1_->SetForceRenderSurface(true);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 1970
1947 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { 1971 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest {
1948 public: 1972 public:
1949 LayerTreeHostTestContinuousInvalidate() 1973 LayerTreeHostTestContinuousInvalidate()
1950 : num_commit_complete_(0), num_draw_layers_(0) {} 1974 : num_commit_complete_(0), num_draw_layers_(0) {}
1951 1975
1952 void BeginTest() override { 1976 void BeginTest() override {
1953 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); 1977 layer_tree_host()->SetViewportSize(gfx::Size(10, 10));
1954 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); 1978 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10));
1955 1979
1956 content_layer_ = ContentLayer::Create(&client_); 1980 if (layer_tree_host()->settings().impl_side_painting)
1957 content_layer_->SetBounds(gfx::Size(10, 10)); 1981 layer_ = FakePictureLayer::Create(&client_);
1958 content_layer_->SetPosition(gfx::PointF(0.f, 0.f)); 1982 else
1959 content_layer_->SetIsDrawable(true); 1983 layer_ = FakeContentLayer::Create(&client_);
1960 layer_tree_host()->root_layer()->AddChild(content_layer_); 1984
1985 layer_->SetBounds(gfx::Size(10, 10));
1986 layer_->SetPosition(gfx::PointF(0.f, 0.f));
1987 layer_->SetIsDrawable(true);
1988 layer_tree_host()->root_layer()->AddChild(layer_);
1961 1989
1962 PostSetNeedsCommitToMainThread(); 1990 PostSetNeedsCommitToMainThread();
1963 } 1991 }
1964 1992
1965 void DidCommitAndDrawFrame() override { 1993 void DidCommitAndDrawFrame() override {
1966 if (num_draw_layers_ == 2) 1994 if (num_draw_layers_ == 2)
1967 return; 1995 return;
1968 content_layer_->SetNeedsDisplay(); 1996 layer_->SetNeedsDisplay();
1969 } 1997 }
1970 1998
1971 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { 1999 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
1972 if (num_draw_layers_ == 1) 2000 if (num_draw_layers_ == 1)
1973 num_commit_complete_++; 2001 num_commit_complete_++;
1974 } 2002 }
1975 2003
1976 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 2004 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
1977 num_draw_layers_++; 2005 num_draw_layers_++;
1978 if (num_draw_layers_ == 2) 2006 if (num_draw_layers_ == 2)
1979 EndTest(); 2007 EndTest();
1980 } 2008 }
1981 2009
1982 void AfterTest() override { 2010 void AfterTest() override {
1983 // Check that we didn't commit twice between first and second draw. 2011 // Check that we didn't commit twice between first and second draw.
1984 EXPECT_EQ(1, num_commit_complete_); 2012 EXPECT_EQ(1, num_commit_complete_);
1985 } 2013 }
1986 2014
1987 private: 2015 private:
1988 FakeContentLayerClient client_; 2016 FakeContentLayerClient client_;
1989 scoped_refptr<Layer> content_layer_; 2017 scoped_refptr<Layer> layer_;
1990 int num_commit_complete_; 2018 int num_commit_complete_;
1991 int num_draw_layers_; 2019 int num_draw_layers_;
1992 }; 2020 };
1993 2021
1994 MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostTestContinuousInvalidate); 2022 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousInvalidate);
1995 2023
1996 class LayerTreeHostTestDeferCommits : public LayerTreeHostTest { 2024 class LayerTreeHostTestDeferCommits : public LayerTreeHostTest {
1997 public: 2025 public:
1998 LayerTreeHostTestDeferCommits() 2026 LayerTreeHostTestDeferCommits()
1999 : num_commits_deferred_(0), num_complete_commits_(0) {} 2027 : num_commits_deferred_(0), num_complete_commits_(0) {}
2000 2028
2001 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 2029 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
2002 2030
2003 void DidDeferCommit() override { 2031 void DidDeferCommit() override {
2004 num_commits_deferred_++; 2032 num_commits_deferred_++;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2187 NULL, 2215 NULL,
2188 settings, 2216 settings,
2189 base::MessageLoopProxy::current(), 2217 base::MessageLoopProxy::current(),
2190 nullptr); 2218 nullptr);
2191 client.SetLayerTreeHost(host.get()); 2219 client.SetLayerTreeHost(host.get());
2192 host->Composite(base::TimeTicks::Now()); 2220 host->Composite(base::TimeTicks::Now());
2193 2221
2194 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); 2222 EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
2195 } 2223 }
2196 2224
2225 // TODO(sohanjg) : Remove it once impl-side painting ships everywhere.
2197 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted 2226 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted
2198 : public LayerTreeHostTest { 2227 : public LayerTreeHostTest {
2199 public: 2228 public:
2200 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() 2229 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted()
2201 : root_layer_(FakeContentLayer::Create(&client_)), 2230 : root_layer_(FakeContentLayer::Create(&client_)),
2202 child_layer1_(FakeContentLayer::Create(&client_)), 2231 child_layer1_(FakeContentLayer::Create(&client_)),
2203 child_layer2_(FakeContentLayer::Create(&client_)), 2232 child_layer2_(FakeContentLayer::Create(&client_)),
2204 num_commits_(0) {} 2233 num_commits_(0) {}
2205 2234
2206 void BeginTest() override { 2235 void BeginTest() override {
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
2591 SINGLE_AND_MULTI_THREAD_TEST_F( 2620 SINGLE_AND_MULTI_THREAD_TEST_F(
2592 LayerTreeHostTestChangeLayerPropertiesInPaintContents); 2621 LayerTreeHostTestChangeLayerPropertiesInPaintContents);
2593 2622
2594 class MockIOSurfaceWebGraphicsContext3D : public TestWebGraphicsContext3D { 2623 class MockIOSurfaceWebGraphicsContext3D : public TestWebGraphicsContext3D {
2595 public: 2624 public:
2596 MockIOSurfaceWebGraphicsContext3D() { 2625 MockIOSurfaceWebGraphicsContext3D() {
2597 test_capabilities_.gpu.iosurface = true; 2626 test_capabilities_.gpu.iosurface = true;
2598 test_capabilities_.gpu.texture_rectangle = true; 2627 test_capabilities_.gpu.texture_rectangle = true;
2599 } 2628 }
2600 2629
2601 virtual GLuint createTexture() override { 2630 GLuint createTexture() override { return 1; }
2602 return 1;
2603 }
2604 MOCK_METHOD1(activeTexture, void(GLenum texture)); 2631 MOCK_METHOD1(activeTexture, void(GLenum texture));
2605 MOCK_METHOD2(bindTexture, void(GLenum target, 2632 MOCK_METHOD2(bindTexture, void(GLenum target,
2606 GLuint texture_id)); 2633 GLuint texture_id));
2607 MOCK_METHOD3(texParameteri, void(GLenum target, 2634 MOCK_METHOD3(texParameteri, void(GLenum target,
2608 GLenum pname, 2635 GLenum pname,
2609 GLint param)); 2636 GLint param));
2610 MOCK_METHOD5(texImageIOSurface2DCHROMIUM, void(GLenum target, 2637 MOCK_METHOD5(texImageIOSurface2DCHROMIUM, void(GLenum target,
2611 GLint width, 2638 GLint width,
2612 GLint height, 2639 GLint height,
2613 GLuint ioSurfaceId, 2640 GLuint ioSurfaceId,
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after
4499 output_surface->SetMemoryPolicyToSetAtBind( 4526 output_surface->SetMemoryPolicyToSetAtBind(
4500 make_scoped_ptr(new ManagedMemoryPolicy( 4527 make_scoped_ptr(new ManagedMemoryPolicy(
4501 second_context_provider_.get() ? second_output_surface_memory_limit_ 4528 second_context_provider_.get() ? second_output_surface_memory_limit_
4502 : first_output_surface_memory_limit_, 4529 : first_output_surface_memory_limit_,
4503 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, 4530 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
4504 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); 4531 ManagedMemoryPolicy::kDefaultNumResourcesLimit)));
4505 return output_surface.Pass(); 4532 return output_surface.Pass();
4506 } 4533 }
4507 4534
4508 void SetupTree() override { 4535 void SetupTree() override {
4509 root_ = FakeContentLayer::Create(&client_); 4536 if (layer_tree_host()->settings().impl_side_painting)
4537 root_ = FakePictureLayer::Create(&client_);
4538 else
4539 root_ = FakeContentLayer::Create(&client_);
4510 root_->SetBounds(gfx::Size(20, 20)); 4540 root_->SetBounds(gfx::Size(20, 20));
4511 layer_tree_host()->SetRootLayer(root_); 4541 layer_tree_host()->SetRootLayer(root_);
4512 LayerTreeHostTest::SetupTree(); 4542 LayerTreeHostTest::SetupTree();
4513 } 4543 }
4514 4544
4515 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4545 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4516 4546
4517 void DidCommitAndDrawFrame() override { 4547 void DidCommitAndDrawFrame() override {
4518 // Lost context sometimes takes two frames to recreate. The third frame 4548 // Lost context sometimes takes two frames to recreate. The third frame
4519 // is sometimes aborted, so wait until the fourth frame to verify that 4549 // is sometimes aborted, so wait until the fourth frame to verify that
(...skipping 21 matching lines...) Expand all
4541 } 4571 }
4542 } 4572 }
4543 4573
4544 void AfterTest() override {} 4574 void AfterTest() override {}
4545 4575
4546 scoped_refptr<TestContextProvider> first_context_provider_; 4576 scoped_refptr<TestContextProvider> first_context_provider_;
4547 scoped_refptr<TestContextProvider> second_context_provider_; 4577 scoped_refptr<TestContextProvider> second_context_provider_;
4548 size_t first_output_surface_memory_limit_; 4578 size_t first_output_surface_memory_limit_;
4549 size_t second_output_surface_memory_limit_; 4579 size_t second_output_surface_memory_limit_;
4550 FakeContentLayerClient client_; 4580 FakeContentLayerClient client_;
4551 scoped_refptr<FakeContentLayer> root_; 4581 scoped_refptr<Layer> root_;
4552 }; 4582 };
4553 4583
4554 // No output to copy for delegated renderers.
4555 SINGLE_AND_MULTI_THREAD_TEST_F( 4584 SINGLE_AND_MULTI_THREAD_TEST_F(
4556 LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface); 4585 LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface);
4557 4586
4558 struct TestSwapPromiseResult { 4587 struct TestSwapPromiseResult {
4559 TestSwapPromiseResult() 4588 TestSwapPromiseResult()
4560 : did_swap_called(false), 4589 : did_swap_called(false),
4561 did_not_swap_called(false), 4590 did_not_swap_called(false),
4562 dtor_called(false), 4591 dtor_called(false),
4563 reason(SwapPromise::DID_NOT_SWAP_UNKNOWN) {} 4592 reason(SwapPromise::DID_NOT_SWAP_UNKNOWN) {}
4564 4593
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
5348 void AfterTest() override { 5377 void AfterTest() override {
5349 EXPECT_TRUE(deltas_sent_to_client_); 5378 EXPECT_TRUE(deltas_sent_to_client_);
5350 } 5379 }
5351 5380
5352 ScrollAndScaleSet info_; 5381 ScrollAndScaleSet info_;
5353 bool deltas_sent_to_client_; 5382 bool deltas_sent_to_client_;
5354 }; 5383 };
5355 5384
5356 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer); 5385 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer);
5357 } // namespace cc 5386 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698