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

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

Issue 1452353002: Turn off computation of the interest rect in cc in synchronized paint mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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/location.h" 10 #include "base/location.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 public: 256 public:
257 void SetupTree() override { 257 void SetupTree() override {
258 client_.set_fill_with_nonsolid_color(true); 258 client_.set_fill_with_nonsolid_color(true);
259 scoped_refptr<FakePictureLayer> root_layer = 259 scoped_refptr<FakePictureLayer> root_layer =
260 FakePictureLayer::Create(layer_settings(), &client_); 260 FakePictureLayer::Create(layer_settings(), &client_);
261 root_layer->SetBounds(gfx::Size(1024, 1024)); 261 root_layer->SetBounds(gfx::Size(1024, 1024));
262 root_layer->SetIsDrawable(true); 262 root_layer->SetIsDrawable(true);
263 263
264 layer_tree_host()->SetRootLayer(root_layer); 264 layer_tree_host()->SetRootLayer(root_layer);
265 LayerTreeHostTest::SetupTree(); 265 LayerTreeHostTest::SetupTree();
266 client_.set_bounds(root_layer->bounds());
266 } 267 }
267 268
268 void AfterTest() override { 269 void AfterTest() override {
269 EXPECT_TRUE(did_notify_ready_to_activate_); 270 EXPECT_TRUE(did_notify_ready_to_activate_);
270 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); 271 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_);
271 EXPECT_LE(size_t(1), required_for_activation_count_); 272 EXPECT_LE(size_t(1), required_for_activation_count_);
272 } 273 }
273 274
274 private: 275 private:
275 FakeContentLayerClient client_; 276 FakeContentLayerClient client_;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 public: 327 public:
327 void SetupTree() override { 328 void SetupTree() override {
328 client_.set_fill_with_nonsolid_color(true); 329 client_.set_fill_with_nonsolid_color(true);
329 scoped_refptr<FakePictureLayer> root_layer = 330 scoped_refptr<FakePictureLayer> root_layer =
330 FakePictureLayer::Create(layer_settings(), &client_); 331 FakePictureLayer::Create(layer_settings(), &client_);
331 root_layer->SetBounds(gfx::Size(1024, 1024)); 332 root_layer->SetBounds(gfx::Size(1024, 1024));
332 root_layer->SetIsDrawable(true); 333 root_layer->SetIsDrawable(true);
333 334
334 layer_tree_host()->SetRootLayer(root_layer); 335 layer_tree_host()->SetRootLayer(root_layer);
335 LayerTreeHostTest::SetupTree(); 336 LayerTreeHostTest::SetupTree();
337 client_.set_bounds(root_layer->bounds());
336 } 338 }
337 339
338 void AfterTest() override { 340 void AfterTest() override {
339 EXPECT_TRUE(did_notify_ready_to_draw_); 341 EXPECT_TRUE(did_notify_ready_to_draw_);
340 EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_); 342 EXPECT_TRUE(all_tiles_required_for_draw_are_ready_to_draw_);
341 EXPECT_LE(size_t(1), required_for_draw_count_); 343 EXPECT_LE(size_t(1), required_for_draw_count_);
342 } 344 }
343 345
344 private: 346 private:
345 FakeContentLayerClient client_; 347 FakeContentLayerClient client_;
(...skipping 13 matching lines...) Expand all
359 did_notify_ready_to_draw_(false), 361 did_notify_ready_to_draw_(false),
360 did_draw_(false) {} 362 did_draw_(false) {}
361 363
362 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 364 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
363 365
364 void SetupTree() override { 366 void SetupTree() override {
365 client_.set_fill_with_nonsolid_color(true); 367 client_.set_fill_with_nonsolid_color(true);
366 scoped_refptr<FakePictureLayer> root_layer = 368 scoped_refptr<FakePictureLayer> root_layer =
367 FakePictureLayer::Create(layer_settings(), &client_); 369 FakePictureLayer::Create(layer_settings(), &client_);
368 root_layer->SetBounds(gfx::Size(1024, 1024)); 370 root_layer->SetBounds(gfx::Size(1024, 1024));
371 client_.set_bounds(root_layer->bounds());
369 root_layer->SetIsDrawable(true); 372 root_layer->SetIsDrawable(true);
370 373
371 layer_tree_host()->SetRootLayer(root_layer); 374 layer_tree_host()->SetRootLayer(root_layer);
372 LayerTreeHostTest::SetupTree(); 375 LayerTreeHostTest::SetupTree();
373 } 376 }
374 377
375 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 378 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
376 if (!toggled_visibility_) { 379 if (!toggled_visibility_) {
377 { 380 {
378 DebugScopedSetMainThread main(task_runner_provider()); 381 DebugScopedSetMainThread main(task_runner_provider());
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 LayerTreeHostTestSetNeedsRedrawRect() 727 LayerTreeHostTestSetNeedsRedrawRect()
725 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} 728 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
726 729
727 void BeginTest() override { 730 void BeginTest() override {
728 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 731 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
729 root_layer_->SetIsDrawable(true); 732 root_layer_->SetIsDrawable(true);
730 root_layer_->SetBounds(bounds_); 733 root_layer_->SetBounds(bounds_);
731 layer_tree_host()->SetRootLayer(root_layer_); 734 layer_tree_host()->SetRootLayer(root_layer_);
732 layer_tree_host()->SetViewportSize(bounds_); 735 layer_tree_host()->SetViewportSize(bounds_);
733 PostSetNeedsCommitToMainThread(); 736 PostSetNeedsCommitToMainThread();
737 client_.set_bounds(root_layer_->bounds());
734 } 738 }
735 739
736 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 740 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
737 LayerTreeHostImpl::FrameData* frame_data, 741 LayerTreeHostImpl::FrameData* frame_data,
738 DrawResult draw_result) override { 742 DrawResult draw_result) override {
739 EXPECT_EQ(DRAW_SUCCESS, draw_result); 743 EXPECT_EQ(DRAW_SUCCESS, draw_result);
740 744
741 gfx::Rect root_damage_rect; 745 gfx::Rect root_damage_rect;
742 if (!frame_data->render_passes.empty()) 746 if (!frame_data->render_passes.empty())
743 root_damage_rect = frame_data->render_passes.back()->damage_rect; 747 root_damage_rect = frame_data->render_passes.back()->damage_rect;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 gfx::Transform transform; 792 gfx::Transform transform;
789 // Translate the layer out of the viewport to force it to not update its 793 // Translate the layer out of the viewport to force it to not update its
790 // tile size via PushProperties. 794 // tile size via PushProperties.
791 transform.Translate(10000.0, 10000.0); 795 transform.Translate(10000.0, 10000.0);
792 root_layer_->SetTransform(transform); 796 root_layer_->SetTransform(transform);
793 root_layer_->SetBounds(bounds_); 797 root_layer_->SetBounds(bounds_);
794 layer_tree_host()->SetRootLayer(root_layer_); 798 layer_tree_host()->SetRootLayer(root_layer_);
795 layer_tree_host()->SetViewportSize(bounds_); 799 layer_tree_host()->SetViewportSize(bounds_);
796 800
797 PostSetNeedsCommitToMainThread(); 801 PostSetNeedsCommitToMainThread();
802 client_.set_bounds(root_layer_->bounds());
798 } 803 }
799 804
800 void InitializeSettings(LayerTreeSettings* settings) override { 805 void InitializeSettings(LayerTreeSettings* settings) override {
801 settings->gpu_rasterization_enabled = true; 806 settings->gpu_rasterization_enabled = true;
802 settings->gpu_rasterization_forced = true; 807 settings->gpu_rasterization_forced = true;
803 } 808 }
804 809
805 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 810 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
806 // Perform 2 commits. 811 // Perform 2 commits.
807 if (!num_draws_) { 812 if (!num_draws_) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 void SetupTree() override { 867 void SetupTree() override {
863 root_layer_ = Layer::Create(layer_settings()); 868 root_layer_ = Layer::Create(layer_settings());
864 root_layer_->SetBounds(gfx::Size(10, 20)); 869 root_layer_->SetBounds(gfx::Size(10, 20));
865 870
866 scaled_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 871 scaled_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
867 scaled_layer_->SetBounds(gfx::Size(1, 1)); 872 scaled_layer_->SetBounds(gfx::Size(1, 1));
868 root_layer_->AddChild(scaled_layer_); 873 root_layer_->AddChild(scaled_layer_);
869 874
870 layer_tree_host()->SetRootLayer(root_layer_); 875 layer_tree_host()->SetRootLayer(root_layer_);
871 LayerTreeHostTest::SetupTree(); 876 LayerTreeHostTest::SetupTree();
877 client_.set_bounds(root_layer_->bounds());
872 } 878 }
873 879
874 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 880 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
875 881
876 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 882 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
877 if (host_impl->active_tree()->source_frame_number() == 1) 883 if (host_impl->active_tree()->source_frame_number() == 1)
878 EndTest(); 884 EndTest();
879 } 885 }
880 886
881 void DidCommit() override { 887 void DidCommit() override {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 bool has_thumb = false; 923 bool has_thumb = false;
918 scrollbar_ = FakePaintedScrollbarLayer::Create( 924 scrollbar_ = FakePaintedScrollbarLayer::Create(
919 layer_settings(), paint_scrollbar, has_thumb, root_layer_->id()); 925 layer_settings(), paint_scrollbar, has_thumb, root_layer_->id());
920 scrollbar_->SetPosition(gfx::PointF(0.f, 10.f)); 926 scrollbar_->SetPosition(gfx::PointF(0.f, 10.f));
921 scrollbar_->SetBounds(gfx::Size(10, 10)); 927 scrollbar_->SetBounds(gfx::Size(10, 10));
922 928
923 root_layer_->AddChild(scrollbar_); 929 root_layer_->AddChild(scrollbar_);
924 930
925 layer_tree_host()->SetRootLayer(root_layer_); 931 layer_tree_host()->SetRootLayer(root_layer_);
926 LayerTreeHostTest::SetupTree(); 932 LayerTreeHostTest::SetupTree();
933 client_.set_bounds(root_layer_->bounds());
927 } 934 }
928 935
929 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 936 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
930 937
931 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 938 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
932 if (host_impl->active_tree()->source_frame_number() == 1) 939 if (host_impl->active_tree()->source_frame_number() == 1)
933 EndTest(); 940 EndTest();
934 } 941 }
935 942
936 void DidCommit() override { 943 void DidCommit() override {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 void SetupTree() override { 976 void SetupTree() override {
970 root_layer_ = Layer::Create(layer_settings()); 977 root_layer_ = Layer::Create(layer_settings());
971 root_layer_->SetBounds(gfx::Size(10, 20)); 978 root_layer_->SetBounds(gfx::Size(10, 20));
972 979
973 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 980 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
974 child_layer_->SetBounds(gfx::Size(10, 10)); 981 child_layer_->SetBounds(gfx::Size(10, 10));
975 root_layer_->AddChild(child_layer_); 982 root_layer_->AddChild(child_layer_);
976 983
977 layer_tree_host()->SetRootLayer(root_layer_); 984 layer_tree_host()->SetRootLayer(root_layer_);
978 LayerTreeHostTest::SetupTree(); 985 LayerTreeHostTest::SetupTree();
986 client_.set_bounds(root_layer_->bounds());
979 } 987 }
980 988
981 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 989 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
982 990
983 void DidCommit() override { 991 void DidCommit() override {
984 if (layer_tree_host()->source_frame_number() == 1) 992 if (layer_tree_host()->source_frame_number() == 1)
985 layer_tree_host()->SetDeviceScaleFactor(4.f); 993 layer_tree_host()->SetDeviceScaleFactor(4.f);
986 } 994 }
987 995
988 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 996 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 LayerTreeHostTestSetNextCommitForcesRedraw() 1036 LayerTreeHostTestSetNextCommitForcesRedraw()
1029 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} 1037 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
1030 1038
1031 void BeginTest() override { 1039 void BeginTest() override {
1032 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 1040 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
1033 root_layer_->SetIsDrawable(true); 1041 root_layer_->SetIsDrawable(true);
1034 root_layer_->SetBounds(bounds_); 1042 root_layer_->SetBounds(bounds_);
1035 layer_tree_host()->SetRootLayer(root_layer_); 1043 layer_tree_host()->SetRootLayer(root_layer_);
1036 layer_tree_host()->SetViewportSize(bounds_); 1044 layer_tree_host()->SetViewportSize(bounds_);
1037 PostSetNeedsCommitToMainThread(); 1045 PostSetNeedsCommitToMainThread();
1046 client_.set_bounds(root_layer_->bounds());
1038 } 1047 }
1039 1048
1040 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 1049 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
1041 if (num_draws_ == 3) 1050 if (num_draws_ == 3)
1042 host_impl->SetNeedsRedrawRect(invalid_rect_); 1051 host_impl->SetNeedsRedrawRect(invalid_rect_);
1043 } 1052 }
1044 1053
1045 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 1054 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
1046 LayerTreeHostImpl::FrameData* frame_data, 1055 LayerTreeHostImpl::FrameData* frame_data,
1047 DrawResult draw_result) override { 1056 DrawResult draw_result) override {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 // The initially transparent layer has a larger child layer, which is 1138 // The initially transparent layer has a larger child layer, which is
1130 // not initially drawn because of the this (parent) layer. 1139 // not initially drawn because of the this (parent) layer.
1131 parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 1140 parent_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
1132 parent_layer_->SetBounds(gfx::Size(15, 15)); 1141 parent_layer_->SetBounds(gfx::Size(15, 15));
1133 parent_layer_->SetOpacity(0.0f); 1142 parent_layer_->SetOpacity(0.0f);
1134 root_layer_->AddChild(parent_layer_); 1143 root_layer_->AddChild(parent_layer_);
1135 1144
1136 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 1145 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
1137 child_layer_->SetBounds(gfx::Size(25, 25)); 1146 child_layer_->SetBounds(gfx::Size(25, 25));
1138 parent_layer_->AddChild(child_layer_); 1147 parent_layer_->AddChild(child_layer_);
1148 client_.set_bounds(root_layer_->bounds());
1139 1149
1140 LayerTreeHostTest::SetupTree(); 1150 LayerTreeHostTest::SetupTree();
1141 } 1151 }
1142 1152
1143 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1153 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1144 1154
1145 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 1155 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
1146 LayerTreeHostImpl::FrameData* frame_data, 1156 LayerTreeHostImpl::FrameData* frame_data,
1147 DrawResult draw_result) override { 1157 DrawResult draw_result) override {
1148 EXPECT_EQ(DRAW_SUCCESS, draw_result); 1158 EXPECT_EQ(DRAW_SUCCESS, draw_result);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 recording.reset(new FakeDisplayListRecordingSource); 1233 recording.reset(new FakeDisplayListRecordingSource);
1224 child_layer_ = FakePictureLayer::CreateWithRecordingSource( 1234 child_layer_ = FakePictureLayer::CreateWithRecordingSource(
1225 layer_settings(), &client_, recording.Pass()); 1235 layer_settings(), &client_, recording.Pass());
1226 child_layer_->SetBounds(gfx::Size(25, 25)); 1236 child_layer_->SetBounds(gfx::Size(25, 25));
1227 child_layer_->SetIsDrawable(true); 1237 child_layer_->SetIsDrawable(true);
1228 child_layer_->SetContentsOpaque(true); 1238 child_layer_->SetContentsOpaque(true);
1229 root_layer_->AddChild(child_layer_); 1239 root_layer_->AddChild(child_layer_);
1230 1240
1231 layer_tree_host()->SetRootLayer(root_layer_); 1241 layer_tree_host()->SetRootLayer(root_layer_);
1232 LayerTreeHostTest::SetupTree(); 1242 LayerTreeHostTest::SetupTree();
1243 client_.set_bounds(root_layer_->bounds());
1233 } 1244 }
1234 1245
1235 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 1246 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
1236 // Force the layer to have a tiling at 1.3f scale. Note that if we simply 1247 // Force the layer to have a tiling at 1.3f scale. Note that if we simply
1237 // add tiling, it will be gone by the time we draw because of aggressive 1248 // add tiling, it will be gone by the time we draw because of aggressive
1238 // cleanup. AddTilingUntilNextDraw ensures that it remains there during 1249 // cleanup. AddTilingUntilNextDraw ensures that it remains there during
1239 // damage calculation. 1250 // damage calculation.
1240 FakePictureLayerImpl* child_layer_impl = static_cast<FakePictureLayerImpl*>( 1251 FakePictureLayerImpl* child_layer_impl = static_cast<FakePictureLayerImpl*>(
1241 host_impl->active_tree()->LayerById(child_layer_->id())); 1252 host_impl->active_tree()->LayerById(child_layer_->id()));
1242 child_layer_impl->AddTilingUntilNextDraw(1.3f); 1253 child_layer_impl->AddTilingUntilNextDraw(1.3f);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 scroll_layer_->SetScrollOffset(gfx::ScrollOffset()); 1473 scroll_layer_->SetScrollOffset(gfx::ScrollOffset());
1463 1474
1464 CreateVirtualViewportLayers(root_layer, 1475 CreateVirtualViewportLayers(root_layer,
1465 scroll_layer_, 1476 scroll_layer_,
1466 root_layer->bounds(), 1477 root_layer->bounds(),
1467 root_layer->bounds(), 1478 root_layer->bounds(),
1468 layer_tree_host(), 1479 layer_tree_host(),
1469 layer_settings()); 1480 layer_settings());
1470 1481
1471 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); 1482 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f);
1483 client_.set_bounds(root_layer->bounds());
1472 } 1484 }
1473 1485
1474 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1486 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1475 1487
1476 void ApplyViewportDeltas(const gfx::Vector2dF& scroll_delta, 1488 void ApplyViewportDeltas(const gfx::Vector2dF& scroll_delta,
1477 const gfx::Vector2dF&, 1489 const gfx::Vector2dF&,
1478 const gfx::Vector2dF& elastic_overscroll_delta, 1490 const gfx::Vector2dF& elastic_overscroll_delta,
1479 float scale, 1491 float scale,
1480 float) override { 1492 float) override {
1481 gfx::ScrollOffset offset = scroll_layer_->scroll_offset(); 1493 gfx::ScrollOffset offset = scroll_layer_->scroll_offset();
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 }; 1560 };
1549 1561
1550 MULTI_THREAD_TEST_F(LayerTreeHostTestSetVisible); 1562 MULTI_THREAD_TEST_F(LayerTreeHostTestSetVisible);
1551 1563
1552 class TestOpacityChangeLayerDelegate : public ContentLayerClient { 1564 class TestOpacityChangeLayerDelegate : public ContentLayerClient {
1553 public: 1565 public:
1554 TestOpacityChangeLayerDelegate() : test_layer_(0) {} 1566 TestOpacityChangeLayerDelegate() : test_layer_(0) {}
1555 1567
1556 void SetTestLayer(Layer* test_layer) { test_layer_ = test_layer; } 1568 void SetTestLayer(Layer* test_layer) { test_layer_ = test_layer; }
1557 1569
1570 gfx::Rect PaintableRegion() override {
1571 return gfx::Rect(test_layer_->bounds());
1572 }
1558 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( 1573 scoped_refptr<DisplayItemList> PaintContentsToDisplayList(
1559 const gfx::Rect& clip, 1574 const gfx::Rect& clip,
1560 PaintingControlSetting picture_control) override { 1575 PaintingControlSetting picture_control) override {
1561 // Set layer opacity to 0. 1576 // Set layer opacity to 0.
1562 if (test_layer_) 1577 if (test_layer_)
1563 test_layer_->SetOpacity(0.f); 1578 test_layer_->SetOpacity(0.f);
1564 1579
1565 // Return a dummy display list. 1580 // Return a dummy display list.
1566 scoped_refptr<DisplayItemList> display_list = 1581 scoped_refptr<DisplayItemList> display_list =
1567 DisplayItemList::Create(clip, DisplayItemListSettings()); 1582 DisplayItemList::Create(clip, DisplayItemListSettings());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size()); 1636 EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size());
1622 1637
1623 root_layer_->AddChild(child_layer_); 1638 root_layer_->AddChild(child_layer_);
1624 1639
1625 root_layer_->SetIsDrawable(true); 1640 root_layer_->SetIsDrawable(true);
1626 root_layer_->SetBounds(gfx::Size(30, 30)); 1641 root_layer_->SetBounds(gfx::Size(30, 30));
1627 1642
1628 child_layer_->SetIsDrawable(true); 1643 child_layer_->SetIsDrawable(true);
1629 child_layer_->SetPosition(gfx::PointF(2.f, 2.f)); 1644 child_layer_->SetPosition(gfx::PointF(2.f, 2.f));
1630 child_layer_->SetBounds(gfx::Size(10, 10)); 1645 child_layer_->SetBounds(gfx::Size(10, 10));
1646 client_.set_bounds(gfx::Size(10, 10));
1631 1647
1632 layer_tree_host()->SetRootLayer(root_layer_); 1648 layer_tree_host()->SetRootLayer(root_layer_);
1633 1649
1634 PostSetNeedsCommitToMainThread(); 1650 PostSetNeedsCommitToMainThread();
1651 client_.set_bounds(root_layer_->bounds());
1635 } 1652 }
1636 1653
1637 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { 1654 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
1638 // Should only do one commit. 1655 // Should only do one commit.
1639 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); 1656 EXPECT_EQ(0, impl->active_tree()->source_frame_number());
1640 // Device scale factor should come over to impl. 1657 // Device scale factor should come over to impl.
1641 EXPECT_NEAR(impl->active_tree()->device_scale_factor(), 1.5f, 0.00001f); 1658 EXPECT_NEAR(impl->active_tree()->device_scale_factor(), 1.5f, 0.00001f);
1642 1659
1643 // Both layers are on impl. 1660 // Both layers are on impl.
1644 ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size()); 1661 ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); 1735 layer_tree_host()->SetViewportSize(gfx::Size(10, 10));
1719 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); 1736 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10));
1720 1737
1721 layer_ = FakePictureLayer::Create(layer_settings(), &client_); 1738 layer_ = FakePictureLayer::Create(layer_settings(), &client_);
1722 layer_->SetBounds(gfx::Size(10, 10)); 1739 layer_->SetBounds(gfx::Size(10, 10));
1723 layer_->SetPosition(gfx::PointF(0.f, 0.f)); 1740 layer_->SetPosition(gfx::PointF(0.f, 0.f));
1724 layer_->SetIsDrawable(true); 1741 layer_->SetIsDrawable(true);
1725 layer_tree_host()->root_layer()->AddChild(layer_); 1742 layer_tree_host()->root_layer()->AddChild(layer_);
1726 1743
1727 PostSetNeedsCommitToMainThread(); 1744 PostSetNeedsCommitToMainThread();
1745 client_.set_bounds(layer_->bounds());
1728 } 1746 }
1729 1747
1730 void DidCommitAndDrawFrame() override { 1748 void DidCommitAndDrawFrame() override {
1731 if (num_draw_layers_ == 2) 1749 if (num_draw_layers_ == 2)
1732 return; 1750 return;
1733 layer_->SetNeedsDisplay(); 1751 layer_->SetNeedsDisplay();
1734 } 1752 }
1735 1753
1736 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { 1754 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
1737 if (num_draw_layers_ == 1) 1755 if (num_draw_layers_ == 1)
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 root_layer->SetBounds(gfx::Size(10, 10)); 1917 root_layer->SetBounds(gfx::Size(10, 10));
1900 root_layer->SetContentsOpaque(true); 1918 root_layer->SetContentsOpaque(true);
1901 1919
1902 layer_tree_host()->SetRootLayer(root_layer); 1920 layer_tree_host()->SetRootLayer(root_layer);
1903 1921
1904 // The expectations are based on the assumption that the default 1922 // The expectations are based on the assumption that the default
1905 // LCD settings are: 1923 // LCD settings are:
1906 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text); 1924 EXPECT_TRUE(layer_tree_host()->settings().can_use_lcd_text);
1907 1925
1908 LayerTreeHostTest::SetupTree(); 1926 LayerTreeHostTest::SetupTree();
1927 client_.set_bounds(root_layer->bounds());
1909 } 1928 }
1910 1929
1911 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 1930 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
1912 1931
1913 void DidCommitAndDrawFrame() override { 1932 void DidCommitAndDrawFrame() override {
1914 switch (layer_tree_host()->source_frame_number()) { 1933 switch (layer_tree_host()->source_frame_number()) {
1915 case 1: 1934 case 1:
1916 PostSetNeedsCommitToMainThread(); 1935 PostSetNeedsCommitToMainThread();
1917 break; 1936 break;
1918 case 2: 1937 case 2:
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 : public LayerTreeHostTest { 2143 : public LayerTreeHostTest {
2125 protected: 2144 protected:
2126 void SetupTree() override { 2145 void SetupTree() override {
2127 LayerTreeHostTest::SetupTree(); 2146 LayerTreeHostTest::SetupTree();
2128 2147
2129 scoped_refptr<Layer> layer = 2148 scoped_refptr<Layer> layer =
2130 PictureLayer::Create(layer_settings(), &client_); 2149 PictureLayer::Create(layer_settings(), &client_);
2131 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); 2150 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
2132 layer->SetBounds(gfx::Size(10, 10)); 2151 layer->SetBounds(gfx::Size(10, 10));
2133 layer_tree_host()->root_layer()->AddChild(layer); 2152 layer_tree_host()->root_layer()->AddChild(layer);
2153 client_.set_bounds(layer->bounds());
2134 } 2154 }
2135 2155
2136 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 2156 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
2137 2157
2138 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 2158 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
2139 EndTest(); 2159 EndTest();
2140 } 2160 }
2141 2161
2142 void AfterTest() override {} 2162 void AfterTest() override {}
2143 2163
2144 FakeContentLayerClient client_; 2164 FakeContentLayerClient client_;
2145 }; 2165 };
2146 2166
2147 SINGLE_AND_MULTI_THREAD_TEST_F( 2167 SINGLE_AND_MULTI_THREAD_TEST_F(
2148 LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation); 2168 LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation);
2149 2169
2150 class LayerTreeHostTestChangeLayerPropertiesInPaintContents 2170 class LayerTreeHostTestChangeLayerPropertiesInPaintContents
2151 : public LayerTreeHostTest { 2171 : public LayerTreeHostTest {
2152 public: 2172 public:
2153 class SetBoundsClient : public ContentLayerClient { 2173 class SetBoundsClient : public ContentLayerClient {
2154 public: 2174 public:
2155 SetBoundsClient() : layer_(0) {} 2175 SetBoundsClient() : layer_(0) {}
2156 2176
2157 void set_layer(Layer* layer) { layer_ = layer; } 2177 void set_layer(Layer* layer) { layer_ = layer; }
2158 2178
2179 gfx::Rect PaintableRegion() override { return gfx::Rect(layer_->bounds()); }
2180
2159 scoped_refptr<DisplayItemList> PaintContentsToDisplayList( 2181 scoped_refptr<DisplayItemList> PaintContentsToDisplayList(
2160 const gfx::Rect& clip, 2182 const gfx::Rect& clip,
2161 PaintingControlSetting picture_control) override { 2183 PaintingControlSetting picture_control) override {
2162 layer_->SetBounds(gfx::Size(2, 2)); 2184 layer_->SetBounds(gfx::Size(2, 2));
2163 2185
2164 // Return a dummy display list. 2186 // Return a dummy display list.
2165 scoped_refptr<DisplayItemList> display_list = 2187 scoped_refptr<DisplayItemList> display_list =
2166 DisplayItemList::Create(clip, DisplayItemListSettings()); 2188 DisplayItemList::Create(clip, DisplayItemListSettings());
2167 return display_list; 2189 return display_list;
2168 } 2190 }
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2413 2435
2414 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 2436 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
2415 child_layer_->SetIsDrawable(true); 2437 child_layer_->SetIsDrawable(true);
2416 child_layer_->SetBounds(gfx::Size(50, 50)); 2438 child_layer_->SetBounds(gfx::Size(50, 50));
2417 2439
2418 root_layer_->AddChild(parent_layer_); 2440 root_layer_->AddChild(parent_layer_);
2419 parent_layer_->AddChild(child_layer_); 2441 parent_layer_->AddChild(child_layer_);
2420 layer_tree_host()->SetRootLayer(root_layer_); 2442 layer_tree_host()->SetRootLayer(root_layer_);
2421 2443
2422 LayerTreeHostTest::SetupTree(); 2444 LayerTreeHostTest::SetupTree();
2445 client_.set_bounds(root_layer_->bounds());
2423 } 2446 }
2424 2447
2425 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { 2448 scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override {
2426 if (delegating_renderer()) { 2449 if (delegating_renderer()) {
2427 return FakeOutputSurface::CreateDelegatingSoftware( 2450 return FakeOutputSurface::CreateDelegatingSoftware(
2428 make_scoped_ptr(new SoftwareOutputDevice)); 2451 make_scoped_ptr(new SoftwareOutputDevice));
2429 } else { 2452 } else {
2430 return FakeOutputSurface::CreateSoftware( 2453 return FakeOutputSurface::CreateSoftware(
2431 make_scoped_ptr(new SoftwareOutputDevice)); 2454 make_scoped_ptr(new SoftwareOutputDevice));
2432 } 2455 }
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
2684 2707
2685 root_->AddChild(child_); 2708 root_->AddChild(child_);
2686 root_->AddChild(child2_); 2709 root_->AddChild(child2_);
2687 child_->AddChild(grandchild_); 2710 child_->AddChild(grandchild_);
2688 child2_->AddChild(leaf_always_pushing_layer_); 2711 child2_->AddChild(leaf_always_pushing_layer_);
2689 2712
2690 other_root_ = PushPropertiesCountingLayer::Create(layer_settings()); 2713 other_root_ = PushPropertiesCountingLayer::Create(layer_settings());
2691 2714
2692 // Don't set the root layer here. 2715 // Don't set the root layer here.
2693 LayerTreeHostTest::SetupTree(); 2716 LayerTreeHostTest::SetupTree();
2717 client_.set_bounds(root_->bounds());
2694 } 2718 }
2695 2719
2696 void DidCommitAndDrawFrame() override { 2720 void DidCommitAndDrawFrame() override {
2697 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count()) 2721 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count())
2698 << "num_commits: " << num_commits_; 2722 << "num_commits: " << num_commits_;
2699 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count()) 2723 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count())
2700 << "num_commits: " << num_commits_; 2724 << "num_commits: " << num_commits_;
2701 EXPECT_EQ(expected_push_properties_grandchild_, 2725 EXPECT_EQ(expected_push_properties_grandchild_,
2702 grandchild_->push_properties_count()) 2726 grandchild_->push_properties_count())
2703 << "num_commits: " << num_commits_; 2727 << "num_commits: " << num_commits_;
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
3187 grandchild2_ = PushPropertiesCountingLayer::Create(layer_settings()); 3211 grandchild2_ = PushPropertiesCountingLayer::Create(layer_settings());
3188 grandchild3_ = PushPropertiesCountingLayer::Create(layer_settings()); 3212 grandchild3_ = PushPropertiesCountingLayer::Create(layer_settings());
3189 3213
3190 root_->AddChild(child_); 3214 root_->AddChild(child_);
3191 child_->AddChild(grandchild1_); 3215 child_->AddChild(grandchild1_);
3192 child_->AddChild(grandchild2_); 3216 child_->AddChild(grandchild2_);
3193 child_->AddChild(grandchild3_); 3217 child_->AddChild(grandchild3_);
3194 3218
3195 // Don't set the root layer here. 3219 // Don't set the root layer here.
3196 LayerTreeHostTest::SetupTree(); 3220 LayerTreeHostTest::SetupTree();
3221 client_.set_bounds(root_->bounds());
3197 } 3222 }
3198 3223
3199 void AfterTest() override {} 3224 void AfterTest() override {}
3200 3225
3201 FakeContentLayerClient client_; 3226 FakeContentLayerClient client_;
3202 scoped_refptr<PushPropertiesCountingLayer> root_; 3227 scoped_refptr<PushPropertiesCountingLayer> root_;
3203 scoped_refptr<PushPropertiesCountingLayer> child_; 3228 scoped_refptr<PushPropertiesCountingLayer> child_;
3204 scoped_refptr<PushPropertiesCountingLayer> grandchild1_; 3229 scoped_refptr<PushPropertiesCountingLayer> grandchild1_;
3205 scoped_refptr<PushPropertiesCountingLayer> grandchild2_; 3230 scoped_refptr<PushPropertiesCountingLayer> grandchild2_;
3206 scoped_refptr<PushPropertiesCountingLayer> grandchild3_; 3231 scoped_refptr<PushPropertiesCountingLayer> grandchild3_;
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
3790 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); 3815 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer);
3791 3816
3792 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { 3817 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest {
3793 protected: 3818 protected:
3794 void SetupTree() override { 3819 void SetupTree() override {
3795 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 3820 root_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
3796 root_layer_->SetBounds(gfx::Size(10, 10)); 3821 root_layer_->SetBounds(gfx::Size(10, 10));
3797 3822
3798 layer_tree_host()->SetRootLayer(root_layer_); 3823 layer_tree_host()->SetRootLayer(root_layer_);
3799 LayerTreeHostTest::SetupTree(); 3824 LayerTreeHostTest::SetupTree();
3825 client_.set_bounds(root_layer_->bounds());
3800 } 3826 }
3801 3827
3802 void BeginTest() override { 3828 void BeginTest() override {
3803 // The viewport is empty, but we still need to update layers on the main 3829 // The viewport is empty, but we still need to update layers on the main
3804 // thread. 3830 // thread.
3805 layer_tree_host()->SetViewportSize(gfx::Size(0, 0)); 3831 layer_tree_host()->SetViewportSize(gfx::Size(0, 0));
3806 PostSetNeedsCommitToMainThread(); 3832 PostSetNeedsCommitToMainThread();
3807 } 3833 }
3808 3834
3809 void DidCommit() override { 3835 void DidCommit() override {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3851 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE, 3877 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
3852 ManagedMemoryPolicy::kDefaultNumResourcesLimit))); 3878 ManagedMemoryPolicy::kDefaultNumResourcesLimit)));
3853 return output_surface.Pass(); 3879 return output_surface.Pass();
3854 } 3880 }
3855 3881
3856 void SetupTree() override { 3882 void SetupTree() override {
3857 root_ = FakePictureLayer::Create(layer_settings(), &client_); 3883 root_ = FakePictureLayer::Create(layer_settings(), &client_);
3858 root_->SetBounds(gfx::Size(20, 20)); 3884 root_->SetBounds(gfx::Size(20, 20));
3859 layer_tree_host()->SetRootLayer(root_); 3885 layer_tree_host()->SetRootLayer(root_);
3860 LayerTreeHostTest::SetupTree(); 3886 LayerTreeHostTest::SetupTree();
3887 client_.set_bounds(root_->bounds());
3861 } 3888 }
3862 3889
3863 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 3890 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
3864 3891
3865 void DidCommitAndDrawFrame() override { 3892 void DidCommitAndDrawFrame() override {
3866 // Lost context sometimes takes two frames to recreate. The third frame 3893 // Lost context sometimes takes two frames to recreate. The third frame
3867 // is sometimes aborted, so wait until the fourth frame to verify that 3894 // is sometimes aborted, so wait until the fourth frame to verify that
3868 // the memory has been set, and the fifth frame to end the test. 3895 // the memory has been set, and the fifth frame to end the test.
3869 if (layer_tree_host()->source_frame_number() < 5) { 3896 if (layer_tree_host()->source_frame_number() < 5) {
3870 layer_tree_host()->SetNeedsCommit(); 3897 layer_tree_host()->SetNeedsCommit();
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
4368 }; 4395 };
4369 4396
4370 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); 4397 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor);
4371 4398
4372 class LayerTreeHostTestHighResRequiredAfterEvictingUIResources 4399 class LayerTreeHostTestHighResRequiredAfterEvictingUIResources
4373 : public LayerTreeHostTest { 4400 : public LayerTreeHostTest {
4374 protected: 4401 protected:
4375 void SetupTree() override { 4402 void SetupTree() override {
4376 LayerTreeHostTest::SetupTree(); 4403 LayerTreeHostTest::SetupTree();
4377 ui_resource_ = FakeScopedUIResource::Create(layer_tree_host()); 4404 ui_resource_ = FakeScopedUIResource::Create(layer_tree_host());
4405 client_.set_bounds(layer_tree_host()->root_layer()->bounds());
4378 } 4406 }
4379 4407
4380 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4408 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4381 4409
4382 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 4410 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
4383 host_impl->EvictAllUIResources(); 4411 host_impl->EvictAllUIResources();
4384 // Existence of evicted UI resources will trigger NEW_CONTENT_TAKES_PRIORITY 4412 // Existence of evicted UI resources will trigger NEW_CONTENT_TAKES_PRIORITY
4385 // mode. Active tree should require high-res to draw after entering this 4413 // mode. Active tree should require high-res to draw after entering this
4386 // mode to ensure that high-res tiles are also required for a pending tree 4414 // mode to ensure that high-res tiles are also required for a pending tree
4387 // to be activated. 4415 // to be activated.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
4424 new FakeDisplayListRecordingSource); 4452 new FakeDisplayListRecordingSource);
4425 recording_source_ = recording_source.get(); 4453 recording_source_ = recording_source.get();
4426 4454
4427 scoped_refptr<FakePictureLayer> layer = 4455 scoped_refptr<FakePictureLayer> layer =
4428 FakePictureLayer::CreateWithRecordingSource( 4456 FakePictureLayer::CreateWithRecordingSource(
4429 layer_settings(), &layer_client_, recording_source.Pass()); 4457 layer_settings(), &layer_client_, recording_source.Pass());
4430 layer_ = layer.get(); 4458 layer_ = layer.get();
4431 layer->SetBounds(gfx::Size(10, 10)); 4459 layer->SetBounds(gfx::Size(10, 10));
4432 layer->SetIsDrawable(true); 4460 layer->SetIsDrawable(true);
4433 layer_tree_host()->root_layer()->AddChild(layer); 4461 layer_tree_host()->root_layer()->AddChild(layer);
4462 layer_client_.set_bounds(layer_->bounds());
4434 } 4463 }
4435 4464
4436 void BeginTest() override { 4465 void BeginTest() override {
4437 // Verify default value. 4466 // Verify default value.
4438 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); 4467 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger());
4439 4468
4440 // Setting gpu rasterization trigger does not enable gpu rasterization. 4469 // Setting gpu rasterization trigger does not enable gpu rasterization.
4441 layer_tree_host()->SetHasGpuRasterizationTrigger(true); 4470 layer_tree_host()->SetHasGpuRasterizationTrigger(true);
4442 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); 4471 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger());
4443 4472
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
4479 new FakeDisplayListRecordingSource); 4508 new FakeDisplayListRecordingSource);
4480 recording_source_ = recording_source.get(); 4509 recording_source_ = recording_source.get();
4481 4510
4482 scoped_refptr<FakePictureLayer> layer = 4511 scoped_refptr<FakePictureLayer> layer =
4483 FakePictureLayer::CreateWithRecordingSource( 4512 FakePictureLayer::CreateWithRecordingSource(
4484 layer_settings(), &layer_client_, recording_source.Pass()); 4513 layer_settings(), &layer_client_, recording_source.Pass());
4485 layer_ = layer.get(); 4514 layer_ = layer.get();
4486 layer->SetBounds(gfx::Size()); 4515 layer->SetBounds(gfx::Size());
4487 layer->SetIsDrawable(true); 4516 layer->SetIsDrawable(true);
4488 layer_tree_host()->root_layer()->AddChild(layer); 4517 layer_tree_host()->root_layer()->AddChild(layer);
4518 layer_client_.set_bounds(layer->bounds());
4489 } 4519 }
4490 4520
4491 void BeginTest() override { 4521 void BeginTest() override {
4492 // Setting gpu rasterization trigger does not enable gpu rasterization. 4522 // Setting gpu rasterization trigger does not enable gpu rasterization.
4493 layer_tree_host()->SetHasGpuRasterizationTrigger(true); 4523 layer_tree_host()->SetHasGpuRasterizationTrigger(true);
4494 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); 4524 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger());
4495 4525
4496 PostSetNeedsCommitToMainThread(); 4526 PostSetNeedsCommitToMainThread();
4497 } 4527 }
4498 4528
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
4536 new FakeDisplayListRecordingSource); 4566 new FakeDisplayListRecordingSource);
4537 recording_source_ = recording_source.get(); 4567 recording_source_ = recording_source.get();
4538 4568
4539 scoped_refptr<FakePictureLayer> layer = 4569 scoped_refptr<FakePictureLayer> layer =
4540 FakePictureLayer::CreateWithRecordingSource( 4570 FakePictureLayer::CreateWithRecordingSource(
4541 layer_settings(), &layer_client_, recording_source.Pass()); 4571 layer_settings(), &layer_client_, recording_source.Pass());
4542 layer_ = layer.get(); 4572 layer_ = layer.get();
4543 layer->SetBounds(gfx::Size(10, 10)); 4573 layer->SetBounds(gfx::Size(10, 10));
4544 layer->SetIsDrawable(true); 4574 layer->SetIsDrawable(true);
4545 layer_tree_host()->root_layer()->AddChild(layer); 4575 layer_tree_host()->root_layer()->AddChild(layer);
4576 layer_client_.set_bounds(layer_->bounds());
4546 } 4577 }
4547 4578
4548 void BeginTest() override { 4579 void BeginTest() override {
4549 // Verify default value. 4580 // Verify default value.
4550 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); 4581 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger());
4551 4582
4552 // Gpu rasterization trigger is relevant. 4583 // Gpu rasterization trigger is relevant.
4553 layer_tree_host()->SetHasGpuRasterizationTrigger(true); 4584 layer_tree_host()->SetHasGpuRasterizationTrigger(true);
4554 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); 4585 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger());
4555 4586
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
4606 recording_source_ = recording_source.get(); 4637 recording_source_ = recording_source.get();
4607 4638
4608 scoped_refptr<FakePictureLayer> layer = 4639 scoped_refptr<FakePictureLayer> layer =
4609 FakePictureLayer::CreateWithRecordingSource( 4640 FakePictureLayer::CreateWithRecordingSource(
4610 layer_settings(), &layer_client_, recording_source.Pass()); 4641 layer_settings(), &layer_client_, recording_source.Pass());
4611 layer_ = layer.get(); 4642 layer_ = layer.get();
4612 4643
4613 layer->SetBounds(gfx::Size(10, 10)); 4644 layer->SetBounds(gfx::Size(10, 10));
4614 layer->SetIsDrawable(true); 4645 layer->SetIsDrawable(true);
4615 layer_tree_host()->root_layer()->AddChild(layer); 4646 layer_tree_host()->root_layer()->AddChild(layer);
4647 layer_client_.set_bounds(layer_->bounds());
4616 } 4648 }
4617 4649
4618 void BeginTest() override { 4650 void BeginTest() override {
4619 // Verify default value. 4651 // Verify default value.
4620 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); 4652 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger());
4621 4653
4622 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. 4654 // With gpu rasterization forced, gpu rasterization trigger is irrelevant.
4623 layer_tree_host()->SetHasGpuRasterizationTrigger(true); 4655 layer_tree_host()->SetHasGpuRasterizationTrigger(true);
4624 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); 4656 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger());
4625 4657
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
4890 4922
4891 void AfterTest() override { 4923 void AfterTest() override {
4892 // Ensure we activated even though the signal was blocked. 4924 // Ensure we activated even though the signal was blocked.
4893 EXPECT_EQ(1, activation_count_); 4925 EXPECT_EQ(1, activation_count_);
4894 EXPECT_TRUE(visible_); 4926 EXPECT_TRUE(visible_);
4895 } 4927 }
4896 4928
4897 private: 4929 private:
4898 int activation_count_; 4930 int activation_count_;
4899 bool visible_; 4931 bool visible_;
4900
4901 FakeContentLayerClient client_;
4902 scoped_refptr<FakePictureLayer> picture_layer_;
4903 }; 4932 };
4904 4933
4905 // TODO(vmpstr): Enable with single thread impl-side painting. 4934 // TODO(vmpstr): Enable with single thread impl-side painting.
4906 // This test blocks activation which is not supported for single thread mode. 4935 // This test blocks activation which is not supported for single thread mode.
4907 MULTI_THREAD_BLOCKNOTIFY_TEST_F(LayerTreeHostTestActivateOnInvisible); 4936 MULTI_THREAD_BLOCKNOTIFY_TEST_F(LayerTreeHostTestActivateOnInvisible);
4908 4937
4909 // Do a synchronous composite and assert that the swap promise succeeds. 4938 // Do a synchronous composite and assert that the swap promise succeeds.
4910 class LayerTreeHostTestSynchronousCompositeSwapPromise 4939 class LayerTreeHostTestSynchronousCompositeSwapPromise
4911 : public LayerTreeHostTest { 4940 : public LayerTreeHostTest {
4912 public: 4941 public:
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
5056 layer->SetBounds(gfx::Size(500, 500)); 5085 layer->SetBounds(gfx::Size(500, 500));
5057 layer->SetContentsOpaque(true); 5086 layer->SetContentsOpaque(true);
5058 // Avoid LCD text on the layer so we don't cause extra commits when we 5087 // Avoid LCD text on the layer so we don't cause extra commits when we
5059 // pinch. 5088 // pinch.
5060 pinch->AddChild(layer); 5089 pinch->AddChild(layer);
5061 5090
5062 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, nullptr); 5091 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, nullptr);
5063 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 5092 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
5064 layer_tree_host()->SetRootLayer(root); 5093 layer_tree_host()->SetRootLayer(root);
5065 LayerTreeHostTest::SetupTree(); 5094 LayerTreeHostTest::SetupTree();
5095 client_.set_bounds(root->bounds());
5066 } 5096 }
5067 5097
5068 // Returns the delta scale of all quads in the frame's root pass from their 5098 // Returns the delta scale of all quads in the frame's root pass from their
5069 // ideal, or 0 if they are not all the same. 5099 // ideal, or 0 if they are not all the same.
5070 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { 5100 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) {
5071 if (frame_data->has_no_damage) 5101 if (frame_data->has_no_damage)
5072 return 0.f; 5102 return 0.f;
5073 float frame_scale = 0.f; 5103 float frame_scale = 0.f;
5074 RenderPass* root_pass = frame_data->render_passes.back(); 5104 RenderPass* root_pass = frame_data->render_passes.back();
5075 for (const auto& draw_quad : root_pass->quad_list) { 5105 for (const auto& draw_quad : root_pass->quad_list) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
5242 5272
5243 void InitializeSettings(LayerTreeSettings* settings) override { 5273 void InitializeSettings(LayerTreeSettings* settings) override {
5244 settings->gpu_rasterization_forced = true; 5274 settings->gpu_rasterization_forced = true;
5245 } 5275 }
5246 5276
5247 void SetupTree() override { 5277 void SetupTree() override {
5248 client_.set_fill_with_nonsolid_color(true); 5278 client_.set_fill_with_nonsolid_color(true);
5249 5279
5250 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 5280 scoped_refptr<Layer> root = Layer::Create(layer_settings());
5251 root->SetBounds(gfx::Size(500, 500)); 5281 root->SetBounds(gfx::Size(500, 500));
5282 client_.set_bounds(root->bounds());
5252 5283
5253 scoped_ptr<FakeDisplayListRecordingSource> recording( 5284 scoped_ptr<FakeDisplayListRecordingSource> recording(
5254 new FakeDisplayListRecordingSource); 5285 new FakeDisplayListRecordingSource);
5255 scoped_refptr<FakePictureLayer> layer = 5286 scoped_refptr<FakePictureLayer> layer =
5256 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, 5287 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
5257 recording.Pass()); 5288 recording.Pass());
5258 layer->SetBounds(gfx::Size(500, 500)); 5289 layer->SetBounds(gfx::Size(500, 500));
5259 layer->SetContentsOpaque(true); 5290 layer->SetContentsOpaque(true);
5260 root->AddChild(layer); 5291 root->AddChild(layer);
5261 5292
5262 layer_tree_host()->SetRootLayer(root); 5293 layer_tree_host()->SetRootLayer(root);
5263 LayerTreeHostTest::SetupTree(); 5294 LayerTreeHostTest::SetupTree();
5295 client_.set_bounds(root->bounds());
5264 } 5296 }
5265 5297
5266 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 5298 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
5267 5299
5268 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 5300 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
5269 LayerTreeHostImpl::FrameData* frame_data, 5301 LayerTreeHostImpl::FrameData* frame_data,
5270 DrawResult draw_result) override { 5302 DrawResult draw_result) override {
5271 EXPECT_NE(0u, host_impl->resource_provider()->num_resources()); 5303 EXPECT_NE(0u, host_impl->resource_provider()->num_resources());
5272 EndTest(); 5304 EndTest();
5273 return draw_result; 5305 return draw_result;
(...skipping 16 matching lines...) Expand all
5290 5322
5291 void SetupTree() override { 5323 void SetupTree() override {
5292 client_.set_fill_with_nonsolid_color(true); 5324 client_.set_fill_with_nonsolid_color(true);
5293 5325
5294 scoped_ptr<FakeDisplayListRecordingSource> recording( 5326 scoped_ptr<FakeDisplayListRecordingSource> recording(
5295 new FakeDisplayListRecordingSource); 5327 new FakeDisplayListRecordingSource);
5296 scoped_refptr<FakePictureLayer> root = 5328 scoped_refptr<FakePictureLayer> root =
5297 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, 5329 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
5298 recording.Pass()); 5330 recording.Pass());
5299 root->SetBounds(gfx::Size(10000, 10000)); 5331 root->SetBounds(gfx::Size(10000, 10000));
5332 client_.set_bounds(root->bounds());
5300 root->SetContentsOpaque(true); 5333 root->SetContentsOpaque(true);
5301 5334
5302 layer_tree_host()->SetRootLayer(root); 5335 layer_tree_host()->SetRootLayer(root);
5303 LayerTreeHostTest::SetupTree(); 5336 LayerTreeHostTest::SetupTree();
5304 layer_tree_host()->SetViewportSize(viewport_size_); 5337 layer_tree_host()->SetViewportSize(viewport_size_);
5338 client_.set_bounds(root->bounds());
5305 } 5339 }
5306 5340
5307 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 5341 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
5308 5342
5309 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 5343 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
5310 LayerTreeHostImpl::FrameData* frame_data, 5344 LayerTreeHostImpl::FrameData* frame_data,
5311 DrawResult draw_result) override { 5345 DrawResult draw_result) override {
5312 EXPECT_EQ(10u, host_impl->resource_provider()->num_resources()); 5346 EXPECT_EQ(10u, host_impl->resource_provider()->num_resources());
5313 EndTest(); 5347 EndTest();
5314 return draw_result; 5348 return draw_result;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
5352 layer->SetBounds(gfx::Size(500, 500)); 5386 layer->SetBounds(gfx::Size(500, 500));
5353 layer->SetContentsOpaque(true); 5387 layer->SetContentsOpaque(true);
5354 // Avoid LCD text on the layer so we don't cause extra commits when we 5388 // Avoid LCD text on the layer so we don't cause extra commits when we
5355 // pinch. 5389 // pinch.
5356 pinch->AddChild(layer); 5390 pinch->AddChild(layer);
5357 5391
5358 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, nullptr); 5392 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, nullptr);
5359 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 5393 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
5360 layer_tree_host()->SetRootLayer(root); 5394 layer_tree_host()->SetRootLayer(root);
5361 LayerTreeHostTest::SetupTree(); 5395 LayerTreeHostTest::SetupTree();
5396 client_.set_bounds(root->bounds());
5362 } 5397 }
5363 5398
5364 // Returns the delta scale of all quads in the frame's root pass from their 5399 // Returns the delta scale of all quads in the frame's root pass from their
5365 // ideal, or 0 if they are not all the same. 5400 // ideal, or 0 if they are not all the same.
5366 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) { 5401 float FrameQuadScaleDeltaFromIdeal(LayerTreeHostImpl::FrameData* frame_data) {
5367 if (frame_data->has_no_damage) 5402 if (frame_data->has_no_damage)
5368 return 0.f; 5403 return 0.f;
5369 float frame_scale = 0.f; 5404 float frame_scale = 0.f;
5370 RenderPass* root_pass = frame_data->render_passes.back(); 5405 RenderPass* root_pass = frame_data->render_passes.back();
5371 for (const auto& draw_quad : root_pass->quad_list) { 5406 for (const auto& draw_quad : root_pass->quad_list) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
5505 5540
5506 void SetupTree() override { 5541 void SetupTree() override {
5507 client_.set_fill_with_nonsolid_color(true); 5542 client_.set_fill_with_nonsolid_color(true);
5508 scoped_refptr<FakePictureLayer> root_layer = 5543 scoped_refptr<FakePictureLayer> root_layer =
5509 FakePictureLayer::Create(layer_settings(), &client_); 5544 FakePictureLayer::Create(layer_settings(), &client_);
5510 root_layer->SetBounds(gfx::Size(1500, 1500)); 5545 root_layer->SetBounds(gfx::Size(1500, 1500));
5511 root_layer->SetIsDrawable(true); 5546 root_layer->SetIsDrawable(true);
5512 5547
5513 layer_tree_host()->SetRootLayer(root_layer); 5548 layer_tree_host()->SetRootLayer(root_layer);
5514 LayerTreeHostTest::SetupTree(); 5549 LayerTreeHostTest::SetupTree();
5550 client_.set_bounds(root_layer->bounds());
5515 } 5551 }
5516 5552
5517 void BeginTest() override { 5553 void BeginTest() override {
5518 layer_tree_host()->SetViewportSize(gfx::Size(16, 16)); 5554 layer_tree_host()->SetViewportSize(gfx::Size(16, 16));
5519 PostSetNeedsCommitToMainThread(); 5555 PostSetNeedsCommitToMainThread();
5520 } 5556 }
5521 5557
5522 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl, 5558 void InitializedRendererOnThread(LayerTreeHostImpl* host_impl,
5523 bool success) override { 5559 bool success) override {
5524 ASSERT_TRUE(success); 5560 ASSERT_TRUE(success);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
5571 child_layer->SetIsDrawable(true); 5607 child_layer->SetIsDrawable(true);
5572 5608
5573 std::vector<FrameTimingRequest> requests; 5609 std::vector<FrameTimingRequest> requests;
5574 requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100))); 5610 requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100)));
5575 requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100))); 5611 requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100)));
5576 child_layer->SetFrameTimingRequests(requests); 5612 child_layer->SetFrameTimingRequests(requests);
5577 5613
5578 root_layer->AddChild(child_layer); 5614 root_layer->AddChild(child_layer);
5579 layer_tree_host()->SetRootLayer(root_layer); 5615 layer_tree_host()->SetRootLayer(root_layer);
5580 LayerTreeHostTest::SetupTree(); 5616 LayerTreeHostTest::SetupTree();
5617 client_.set_bounds(root_layer->bounds());
5581 } 5618 }
5582 5619
5583 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 5620 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
5584 5621
5585 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { 5622 void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override {
5586 if (!check_results_on_commit_) 5623 if (!check_results_on_commit_)
5587 return; 5624 return;
5588 5625
5589 // Since in reality, the events will be read by LayerTreeHost during commit, 5626 // Since in reality, the events will be read by LayerTreeHost during commit,
5590 // we check the requests here to ensure that they are correct at the next 5627 // we check the requests here to ensure that they are correct at the next
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
5647 5684
5648 void SetupTree() override { 5685 void SetupTree() override {
5649 client_.set_fill_with_nonsolid_color(true); 5686 client_.set_fill_with_nonsolid_color(true);
5650 scoped_refptr<FakePictureLayer> root_layer = 5687 scoped_refptr<FakePictureLayer> root_layer =
5651 FakePictureLayer::Create(layer_settings(), &client_); 5688 FakePictureLayer::Create(layer_settings(), &client_);
5652 root_layer->SetBounds(gfx::Size(150, 150)); 5689 root_layer->SetBounds(gfx::Size(150, 150));
5653 root_layer->SetIsDrawable(true); 5690 root_layer->SetIsDrawable(true);
5654 5691
5655 layer_tree_host()->SetRootLayer(root_layer); 5692 layer_tree_host()->SetRootLayer(root_layer);
5656 LayerTreeHostTest::SetupTree(); 5693 LayerTreeHostTest::SetupTree();
5694 client_.set_bounds(root_layer->bounds());
5657 } 5695 }
5658 5696
5659 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 5697 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
5660 5698
5661 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override { 5699 void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override {
5662 // Ensure we've already activated. 5700 // Ensure we've already activated.
5663 EXPECT_FALSE(impl->pending_tree()); 5701 EXPECT_FALSE(impl->pending_tree());
5664 5702
5665 // After activating, we either need to prepare tiles, or we've already 5703 // After activating, we either need to prepare tiles, or we've already
5666 // called a scheduled prepare tiles. This is done because activation might 5704 // called a scheduled prepare tiles. This is done because activation might
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
5801 gfx::Size child_size(50, 50); 5839 gfx::Size child_size(50, 50);
5802 content_child_layer->SetBounds(child_size); 5840 content_child_layer->SetBounds(child_size);
5803 content_child_layer->SetPosition(gfx::PointF(20.f, 0.f)); 5841 content_child_layer->SetPosition(gfx::PointF(20.f, 0.f));
5804 5842
5805 gfx::Size mask_size(100, 100); 5843 gfx::Size mask_size(100, 100);
5806 mask_layer->SetBounds(mask_size); 5844 mask_layer->SetBounds(mask_size);
5807 mask_layer->SetIsMask(true); 5845 mask_layer->SetIsMask(true);
5808 5846
5809 layer_tree_host()->SetRootLayer(root); 5847 layer_tree_host()->SetRootLayer(root);
5810 LayerTreeTest::SetupTree(); 5848 LayerTreeTest::SetupTree();
5849 client_.set_bounds(root->bounds());
5811 } 5850 }
5812 5851
5813 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 5852 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
5814 5853
5815 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 5854 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
5816 LayerTreeHostImpl::FrameData* frame_data, 5855 LayerTreeHostImpl::FrameData* frame_data,
5817 DrawResult draw_result) override { 5856 DrawResult draw_result) override {
5818 EXPECT_EQ(2u, frame_data->render_passes.size()); 5857 EXPECT_EQ(2u, frame_data->render_passes.size());
5819 RenderPass* root_pass = frame_data->render_passes.back(); 5858 RenderPass* root_pass = frame_data->render_passes.back();
5820 EXPECT_EQ(2u, root_pass->quad_list.size()); 5859 EXPECT_EQ(2u, root_pass->quad_list.size());
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
5885 scale.Scale(2.f, 2.f); 5924 scale.Scale(2.f, 2.f);
5886 scaling_layer->SetTransform(scale); 5925 scaling_layer->SetTransform(scale);
5887 5926
5888 content_layer->SetBounds(scaling_layer_size); 5927 content_layer->SetBounds(scaling_layer_size);
5889 5928
5890 mask_layer->SetBounds(scaling_layer_size); 5929 mask_layer->SetBounds(scaling_layer_size);
5891 mask_layer->SetIsMask(true); 5930 mask_layer->SetIsMask(true);
5892 5931
5893 layer_tree_host()->SetRootLayer(root); 5932 layer_tree_host()->SetRootLayer(root);
5894 LayerTreeTest::SetupTree(); 5933 LayerTreeTest::SetupTree();
5934 client_.set_bounds(root->bounds());
5895 } 5935 }
5896 5936
5897 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 5937 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
5898 5938
5899 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 5939 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
5900 LayerTreeHostImpl::FrameData* frame_data, 5940 LayerTreeHostImpl::FrameData* frame_data,
5901 DrawResult draw_result) override { 5941 DrawResult draw_result) override {
5902 EXPECT_EQ(2u, frame_data->render_passes.size()); 5942 EXPECT_EQ(2u, frame_data->render_passes.size());
5903 RenderPass* root_pass = frame_data->render_passes.back(); 5943 RenderPass* root_pass = frame_data->render_passes.back();
5904 EXPECT_EQ(2u, root_pass->quad_list.size()); 5944 EXPECT_EQ(2u, root_pass->quad_list.size());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
5973 6013
5974 gfx::Size layer_size(50, 50); 6014 gfx::Size layer_size(50, 50);
5975 content_layer->SetBounds(layer_size); 6015 content_layer->SetBounds(layer_size);
5976 6016
5977 gfx::Size mask_size(100, 100); 6017 gfx::Size mask_size(100, 100);
5978 mask_layer->SetBounds(mask_size); 6018 mask_layer->SetBounds(mask_size);
5979 mask_layer->SetIsMask(true); 6019 mask_layer->SetIsMask(true);
5980 6020
5981 layer_tree_host()->SetRootLayer(root); 6021 layer_tree_host()->SetRootLayer(root);
5982 LayerTreeTest::SetupTree(); 6022 LayerTreeTest::SetupTree();
6023 client_.set_bounds(root->bounds());
5983 } 6024 }
5984 6025
5985 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6026 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
5986 6027
5987 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 6028 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
5988 LayerTreeHostImpl::FrameData* frame_data, 6029 LayerTreeHostImpl::FrameData* frame_data,
5989 DrawResult draw_result) override { 6030 DrawResult draw_result) override {
5990 EXPECT_EQ(2u, frame_data->render_passes.size()); 6031 EXPECT_EQ(2u, frame_data->render_passes.size());
5991 RenderPass* root_pass = frame_data->render_passes.back(); 6032 RenderPass* root_pass = frame_data->render_passes.back();
5992 EXPECT_EQ(2u, root_pass->quad_list.size()); 6033 EXPECT_EQ(2u, root_pass->quad_list.size());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
6064 6105
6065 gfx::Size layer_size(50, 50); 6106 gfx::Size layer_size(50, 50);
6066 content_layer->SetBounds(layer_size); 6107 content_layer->SetBounds(layer_size);
6067 6108
6068 gfx::Size mask_size(100, 100); 6109 gfx::Size mask_size(100, 100);
6069 mask_layer->SetBounds(mask_size); 6110 mask_layer->SetBounds(mask_size);
6070 mask_layer->SetIsMask(true); 6111 mask_layer->SetIsMask(true);
6071 6112
6072 layer_tree_host()->SetRootLayer(root); 6113 layer_tree_host()->SetRootLayer(root);
6073 LayerTreeTest::SetupTree(); 6114 LayerTreeTest::SetupTree();
6115 client_.set_bounds(root->bounds());
6074 } 6116 }
6075 6117
6076 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6118 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6077 6119
6078 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 6120 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
6079 LayerTreeHostImpl::FrameData* frame_data, 6121 LayerTreeHostImpl::FrameData* frame_data,
6080 DrawResult draw_result) override { 6122 DrawResult draw_result) override {
6081 EXPECT_EQ(2u, frame_data->render_passes.size()); 6123 EXPECT_EQ(2u, frame_data->render_passes.size());
6082 RenderPass* root_pass = frame_data->render_passes.back(); 6124 RenderPass* root_pass = frame_data->render_passes.back();
6083 EXPECT_EQ(3u, root_pass->quad_list.size()); 6125 EXPECT_EQ(3u, root_pass->quad_list.size());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
6162 content_layer->SetBounds(layer_size); 6204 content_layer->SetBounds(layer_size);
6163 content_child_layer_->SetBounds(layer_size); 6205 content_child_layer_->SetBounds(layer_size);
6164 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f)); 6206 content_child_layer_->SetPosition(gfx::PointF(50.f, 0.f));
6165 6207
6166 gfx::Size mask_size(100, 100); 6208 gfx::Size mask_size(100, 100);
6167 mask_layer->SetBounds(mask_size); 6209 mask_layer->SetBounds(mask_size);
6168 mask_layer->SetIsMask(true); 6210 mask_layer->SetIsMask(true);
6169 6211
6170 layer_tree_host()->SetRootLayer(root); 6212 layer_tree_host()->SetRootLayer(root);
6171 LayerTreeTest::SetupTree(); 6213 LayerTreeTest::SetupTree();
6214 client_.set_bounds(root->bounds());
6172 } 6215 }
6173 6216
6174 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 6217 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6175 6218
6176 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 6219 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
6177 LayerTreeHostImpl::FrameData* frame_data, 6220 LayerTreeHostImpl::FrameData* frame_data,
6178 DrawResult draw_result) override { 6221 DrawResult draw_result) override {
6179 EXPECT_EQ(2u, frame_data->render_passes.size()); 6222 EXPECT_EQ(2u, frame_data->render_passes.size());
6180 RenderPass* root_pass = frame_data->render_passes.back(); 6223 RenderPass* root_pass = frame_data->render_passes.back();
6181 EXPECT_EQ(3u, root_pass->quad_list.size()); 6224 EXPECT_EQ(3u, root_pass->quad_list.size());
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
6404 EndTest(); 6447 EndTest();
6405 } 6448 }
6406 6449
6407 void AfterTest() override {} 6450 void AfterTest() override {}
6408 }; 6451 };
6409 6452
6410 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); 6453 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor);
6411 6454
6412 } // namespace 6455 } // namespace
6413 } // namespace cc 6456 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698