OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 num_draws_++; | 76 num_draws_++; |
77 if (!impl->active_tree()->source_frame_number()) | 77 if (!impl->active_tree()->source_frame_number()) |
78 EndTest(); | 78 EndTest(); |
79 } | 79 } |
80 | 80 |
81 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 81 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
82 num_commits_++; | 82 num_commits_++; |
83 } | 83 } |
84 | 84 |
85 virtual void AfterTest() OVERRIDE { | 85 virtual void AfterTest() OVERRIDE { |
86 EXPECT_GE(1, num_commits_); | 86 EXPECT_GE(num_commits_, 1); |
87 EXPECT_GE(1, num_draws_); | 87 EXPECT_GE(num_draws_, 1); |
88 } | 88 } |
89 | 89 |
90 private: | 90 private: |
91 int num_commits_; | 91 int num_commits_; |
92 int num_draws_; | 92 int num_draws_; |
93 }; | 93 }; |
94 | 94 |
95 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit1); | 95 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit1); |
96 | 96 |
97 // A SetNeedsCommit should lead to 1 commit. Issuing a second commit after that | 97 // A SetNeedsCommit should lead to 1 commit. Issuing a second commit after that |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 enum Properties { | 145 enum Properties { |
146 STARTUP, | 146 STARTUP, |
147 BOUNDS, | 147 BOUNDS, |
148 HIDE_LAYER_AND_SUBTREE, | 148 HIDE_LAYER_AND_SUBTREE, |
149 DRAWS_CONTENT, | 149 DRAWS_CONTENT, |
150 DONE, | 150 DONE, |
151 }; | 151 }; |
152 | 152 |
153 virtual void BeginTest() OVERRIDE { | 153 virtual void BeginTest() OVERRIDE { |
154 index_ = STARTUP; | 154 index_ = STARTUP; |
| 155 index_impl_ = STARTUP; |
155 PostSetNeedsCommitToMainThread(); | 156 PostSetNeedsCommitToMainThread(); |
156 } | 157 } |
157 | 158 |
158 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 159 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
159 VerifyAfterValues(impl->active_tree()->root_layer()); | 160 VerifyAfterValues(impl->active_tree()->root_layer()); |
160 } | 161 } |
161 | 162 |
162 virtual void DidCommitAndDrawFrame() OVERRIDE { | 163 virtual void DidCommitAndDrawFrame() OVERRIDE { |
163 SetBeforeValues(layer_tree_host()->root_layer()); | 164 SetBeforeValues(layer_tree_host()->root_layer()); |
164 VerifyBeforeValues(layer_tree_host()->root_layer()); | 165 VerifyBeforeValues(layer_tree_host()->root_layer()); |
165 | 166 |
166 ++index_; | 167 ++index_; |
167 if (index_ == DONE) { | 168 if (index_ == DONE); |
168 EndTest(); | 169 EndTest(); |
169 return; | |
170 } | |
171 | 170 |
172 SetAfterValues(layer_tree_host()->root_layer()); | 171 SetAfterValues(layer_tree_host()->root_layer()); |
173 } | 172 } |
174 | 173 |
175 virtual void AfterTest() OVERRIDE {} | 174 virtual void AfterTest() OVERRIDE {} |
176 | 175 |
177 void VerifyBeforeValues(Layer* layer) { | 176 void VerifyBeforeValues(Layer* layer) { |
178 EXPECT_EQ(gfx::Size(10, 10).ToString(), layer->bounds().ToString()); | 177 EXPECT_EQ(gfx::Size(10, 10).ToString(), layer->bounds().ToString()); |
179 EXPECT_FALSE(layer->hide_layer_and_subtree()); | 178 EXPECT_FALSE(layer->hide_layer_and_subtree()); |
180 EXPECT_FALSE(layer->DrawsContent()); | 179 EXPECT_FALSE(layer->DrawsContent()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 case HIDE_LAYER_AND_SUBTREE: | 213 case HIDE_LAYER_AND_SUBTREE: |
215 layer->SetHideLayerAndSubtree(true); | 214 layer->SetHideLayerAndSubtree(true); |
216 break; | 215 break; |
217 case DRAWS_CONTENT: | 216 case DRAWS_CONTENT: |
218 layer->SetIsDrawable(true); | 217 layer->SetIsDrawable(true); |
219 break; | 218 break; |
220 } | 219 } |
221 } | 220 } |
222 | 221 |
223 int index_; | 222 int index_; |
| 223 int index_impl_; |
224 }; | 224 }; |
225 | 225 |
226 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); | 226 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); |
227 | 227 |
228 // 1 setNeedsRedraw after the first commit has completed should lead to 1 | 228 // 1 setNeedsRedraw after the first commit has completed should lead to 1 |
229 // additional draw. | 229 // additional draw. |
230 class LayerTreeHostTestSetNeedsRedraw : public LayerTreeHostTest { | 230 class LayerTreeHostTestSetNeedsRedraw : public LayerTreeHostTest { |
231 public: | 231 public: |
232 LayerTreeHostTestSetNeedsRedraw() : num_commits_(0), num_draws_(0) {} | 232 LayerTreeHostTestSetNeedsRedraw() : num_commits_(0), num_draws_(0) {} |
233 | 233 |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 | 612 |
613 // A compositeAndReadback while invisible should force a normal commit without | 613 // A compositeAndReadback while invisible should force a normal commit without |
614 // assertion. | 614 // assertion. |
615 class LayerTreeHostTestCompositeAndReadbackWhileInvisible | 615 class LayerTreeHostTestCompositeAndReadbackWhileInvisible |
616 : public LayerTreeHostTest { | 616 : public LayerTreeHostTest { |
617 public: | 617 public: |
618 LayerTreeHostTestCompositeAndReadbackWhileInvisible() : num_commits_(0) {} | 618 LayerTreeHostTestCompositeAndReadbackWhileInvisible() : num_commits_(0) {} |
619 | 619 |
620 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 620 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
621 | 621 |
622 virtual void DidCommitAndDrawFrame() OVERRIDE { | 622 virtual void DidCommit() OVERRIDE { |
623 num_commits_++; | 623 num_commits_++; |
624 if (num_commits_ == 1) { | 624 if (num_commits_ == 1) { |
625 layer_tree_host()->SetVisible(false); | 625 layer_tree_host()->SetVisible(false); |
626 layer_tree_host()->SetNeedsCommit(); | 626 layer_tree_host()->SetNeedsCommit(); |
627 layer_tree_host()->SetNeedsCommit(); | 627 layer_tree_host()->SetNeedsCommit(); |
628 char pixels[4]; | 628 char pixels[4]; |
629 layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); | 629 layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); |
630 } else { | 630 } else { |
631 EndTest(); | 631 EndTest(); |
632 } | 632 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 }; | 691 }; |
692 | 692 |
693 MULTI_THREAD_TEST_F(LayerTreeHostTestCommit); | 693 MULTI_THREAD_TEST_F(LayerTreeHostTestCommit); |
694 | 694 |
695 // This test verifies that LayerTreeHostImpl's current frame time gets | 695 // This test verifies that LayerTreeHostImpl's current frame time gets |
696 // updated in consecutive frames when it doesn't draw due to tree | 696 // updated in consecutive frames when it doesn't draw due to tree |
697 // activation failure. | 697 // activation failure. |
698 class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails | 698 class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails |
699 : public LayerTreeHostTest { | 699 : public LayerTreeHostTest { |
700 public: | 700 public: |
701 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails() : frame_(0) {} | 701 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails() |
| 702 : frame_count_with_pending_tree_(0) {} |
702 | 703 |
703 virtual void BeginTest() OVERRIDE { | 704 virtual void BeginTest() OVERRIDE { |
704 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); | 705 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); |
705 layer_tree_host()->set_background_color(SK_ColorGRAY); | 706 layer_tree_host()->set_background_color(SK_ColorGRAY); |
706 | 707 |
707 PostSetNeedsCommitToMainThread(); | 708 PostSetNeedsCommitToMainThread(); |
708 } | 709 } |
709 | 710 |
| 711 virtual void WillBeginFrameOnThread(LayerTreeHostImpl* host_impl, |
| 712 const BeginFrameArgs &args) OVERRIDE { |
| 713 TRACE_EVENT0("cc", "WillBeginFrameOnThreadbca"); |
| 714 if (host_impl->pending_tree()) |
| 715 frame_count_with_pending_tree_++; |
| 716 } |
| 717 |
710 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 718 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
711 if (frame_ >= 1) { | 719 if (frame_count_with_pending_tree_ > 1) { |
712 EXPECT_NE(first_frame_time_, impl->CurrentFrameTimeTicks()); | 720 EXPECT_NE(first_frame_time_.ToInternalValue(), |
| 721 impl->CurrentFrameTimeTicks().ToInternalValue()); |
713 EndTest(); | 722 EndTest(); |
714 return; | 723 return; |
715 } | 724 } |
716 | 725 |
717 EXPECT_FALSE(impl->settings().impl_side_painting); | 726 EXPECT_FALSE(impl->settings().impl_side_painting); |
718 EndTest(); | 727 EndTest(); |
719 } | 728 } |
720 | 729 |
721 virtual bool CanActivatePendingTree(LayerTreeHostImpl* impl) OVERRIDE { | 730 virtual bool CanActivatePendingTree(LayerTreeHostImpl* impl) OVERRIDE { |
722 if (frame_ >= 1) | 731 return frame_count_with_pending_tree_ > 1; |
723 return true; | |
724 | |
725 return false; | |
726 } | 732 } |
727 | 733 |
728 virtual bool CanActivatePendingTreeIfNeeded(LayerTreeHostImpl* impl) | 734 virtual bool CanActivatePendingTreeIfNeeded(LayerTreeHostImpl* impl) |
729 OVERRIDE { | 735 OVERRIDE { |
730 frame_++; | 736 if (frame_count_with_pending_tree_ > 1) |
731 if (frame_ == 1) { | 737 return true; |
| 738 |
| 739 if (first_frame_time_.is_null()) { |
732 first_frame_time_ = impl->CurrentFrameTimeTicks(); | 740 first_frame_time_ = impl->CurrentFrameTimeTicks(); |
733 | 741 |
734 // Since base::TimeTicks::Now() uses a low-resolution clock on | 742 // Since base::TimeTicks::Now() uses a low-resolution clock on |
735 // Windows, we need to make sure that the clock has incremented past | 743 // Windows, we need to make sure that the clock has incremented past |
736 // first_frame_time_. | 744 // first_frame_time_. |
737 while (first_frame_time_ == base::TimeTicks::Now()) {} | 745 while (first_frame_time_ == base::TimeTicks::Now()) {} |
| 746 } |
| 747 return false; |
| 748 } |
738 | 749 |
739 return false; | 750 virtual void DidActivateTreeOnThread(LayerTreeHostImpl *impl) OVERRIDE { |
740 } | 751 if (impl->settings().impl_side_painting) |
741 | 752 EXPECT_NE(frame_count_with_pending_tree_, 1); |
742 return true; | |
743 } | 753 } |
744 | 754 |
745 virtual void AfterTest() OVERRIDE {} | 755 virtual void AfterTest() OVERRIDE {} |
746 | 756 |
747 private: | 757 private: |
748 int frame_; | 758 int frame_count_with_pending_tree_; |
749 base::TimeTicks first_frame_time_; | 759 base::TimeTicks first_frame_time_; |
750 }; | 760 }; |
751 | 761 |
752 SINGLE_AND_MULTI_THREAD_TEST_F( | 762 SINGLE_AND_MULTI_THREAD_TEST_F( |
753 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); | 763 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); |
754 | 764 |
755 // This test verifies that LayerTreeHostImpl's current frame time gets | 765 // This test verifies that LayerTreeHostImpl's current frame time gets |
756 // updated in consecutive frames when it draws in each frame. | 766 // updated in consecutive frames when it draws in each frame. |
757 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { | 767 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { |
758 public: | 768 public: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 scroll_layer_->SetScrollOffset(gfx::Vector2d()); | 825 scroll_layer_->SetScrollOffset(gfx::Vector2d()); |
816 layer_tree_host()->root_layer()->AddChild(scroll_layer_); | 826 layer_tree_host()->root_layer()->AddChild(scroll_layer_); |
817 } | 827 } |
818 | 828 |
819 virtual void BeginTest() OVERRIDE { | 829 virtual void BeginTest() OVERRIDE { |
820 PostSetNeedsCommitToMainThread(); | 830 PostSetNeedsCommitToMainThread(); |
821 } | 831 } |
822 | 832 |
823 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, float scale) | 833 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, float scale) |
824 OVERRIDE { | 834 OVERRIDE { |
| 835 TRACE_EVENT0("cc", "ApplyScrollAndScale9"); |
825 gfx::Vector2d offset = scroll_layer_->scroll_offset(); | 836 gfx::Vector2d offset = scroll_layer_->scroll_offset(); |
826 scroll_layer_->SetScrollOffset(offset + scroll_delta); | 837 scroll_layer_->SetScrollOffset(offset + scroll_delta); |
827 layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f); | 838 layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f); |
828 } | 839 } |
829 | 840 |
830 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 841 virtual void SwapBuffersOnThread(LayerTreeHostImpl *impl, bool result) |
831 impl->ProcessScrollDeltas(); | 842 OVERRIDE { |
832 // We get one commit before the first draw, and the animation doesn't happen | 843 // We get one commit before the first draw, and the animation doesn't happen |
833 // until the second draw. | 844 // until the second draw. |
834 switch (impl->active_tree()->source_frame_number()) { | 845 switch (impl->active_tree()->source_frame_number()) { |
835 case 0: | 846 case 0: |
836 EXPECT_EQ(1.f, impl->active_tree()->page_scale_factor()); | 847 EXPECT_EQ(1.f, impl->active_tree()->page_scale_factor()); |
837 // We'll start an animation when we get back to the main thread. | 848 // We'll start an animation when we get back to the main thread. |
838 break; | 849 break; |
839 case 1: | 850 case 1: |
840 EXPECT_EQ(1.f, impl->active_tree()->page_scale_factor()); | 851 EXPECT_EQ(1.f, impl->active_tree()->page_scale_factor()); |
841 PostSetNeedsRedrawToMainThread(); | |
842 break; | 852 break; |
843 case 2: | 853 case 2: |
| 854 case 3: |
| 855 case 4: |
844 EXPECT_EQ(1.25f, impl->active_tree()->page_scale_factor()); | 856 EXPECT_EQ(1.25f, impl->active_tree()->page_scale_factor()); |
| 857 PostSetNeedsCommitToMainThread(); |
| 858 break; |
| 859 case 5: |
845 EndTest(); | 860 EndTest(); |
846 break; | 861 break; |
847 default: | 862 default: |
848 NOTREACHED(); | 863 NOTREACHED(); |
849 } | 864 } |
850 } | 865 } |
851 | 866 |
852 virtual void DidCommitAndDrawFrame() OVERRIDE { | 867 virtual void DidCommit() OVERRIDE { |
853 switch (layer_tree_host()->source_frame_number()) { | 868 switch (layer_tree_host()->source_frame_number()) { |
854 case 1: | 869 case 1: |
855 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); | 870 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); |
856 layer_tree_host()->StartPageScaleAnimation( | 871 layer_tree_host()->StartPageScaleAnimation( |
857 gfx::Vector2d(), false, 1.25f, base::TimeDelta()); | 872 gfx::Vector2d(), false, 1.25f, base::TimeDelta()); |
858 break; | 873 break; |
859 } | 874 } |
860 } | 875 } |
861 | 876 |
862 virtual void AfterTest() OVERRIDE {} | 877 virtual void AfterTest() OVERRIDE {} |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 parent_->AddChild(child_); | 1268 parent_->AddChild(child_); |
1254 | 1269 |
1255 layer_tree_host()->SetRootLayer(parent_); | 1270 layer_tree_host()->SetRootLayer(parent_); |
1256 LayerTreeHostTest::SetupTree(); | 1271 LayerTreeHostTest::SetupTree(); |
1257 } | 1272 } |
1258 | 1273 |
1259 virtual void BeginTest() OVERRIDE { | 1274 virtual void BeginTest() OVERRIDE { |
1260 PostSetNeedsCommitToMainThread(); | 1275 PostSetNeedsCommitToMainThread(); |
1261 } | 1276 } |
1262 | 1277 |
1263 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1278 virtual void DidCommit() OVERRIDE { |
1264 switch (layer_tree_host()->source_frame_number()) { | 1279 switch (layer_tree_host()->source_frame_number()) { |
1265 case 1: | 1280 case 1: |
1266 parent_->SetNeedsDisplay(); | 1281 parent_->SetNeedsDisplay(); |
1267 child_->SetNeedsDisplay(); | 1282 child_->SetNeedsDisplay(); |
1268 break; | 1283 break; |
1269 case 2: | 1284 case 2: |
1270 // Damage part of layers. | 1285 // Damage part of layers. |
1271 parent_->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f)); | 1286 parent_->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f)); |
1272 child_->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f)); | 1287 child_->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f)); |
1273 break; | 1288 break; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1384 | 1399 |
1385 class LayerTreeHostTestFinishAllRendering : public LayerTreeHostTest { | 1400 class LayerTreeHostTestFinishAllRendering : public LayerTreeHostTest { |
1386 public: | 1401 public: |
1387 LayerTreeHostTestFinishAllRendering() : once_(false), draw_count_(0) {} | 1402 LayerTreeHostTestFinishAllRendering() : once_(false), draw_count_(0) {} |
1388 | 1403 |
1389 virtual void BeginTest() OVERRIDE { | 1404 virtual void BeginTest() OVERRIDE { |
1390 layer_tree_host()->SetNeedsRedraw(); | 1405 layer_tree_host()->SetNeedsRedraw(); |
1391 PostSetNeedsCommitToMainThread(); | 1406 PostSetNeedsCommitToMainThread(); |
1392 } | 1407 } |
1393 | 1408 |
1394 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1409 virtual void DidCommit() OVERRIDE { |
1395 if (once_) | 1410 if (once_) |
1396 return; | 1411 return; |
1397 once_ = true; | 1412 once_ = true; |
1398 layer_tree_host()->SetNeedsRedraw(); | 1413 layer_tree_host()->SetNeedsRedraw(); |
1399 layer_tree_host()->AcquireLayerTextures(); | 1414 layer_tree_host()->AcquireLayerTextures(); |
1400 { | 1415 { |
1401 base::AutoLock lock(lock_); | 1416 base::AutoLock lock(lock_); |
1402 draw_count_ = 0; | 1417 draw_count_ = 0; |
1403 } | 1418 } |
1404 layer_tree_host()->FinishAllRendering(); | 1419 layer_tree_host()->FinishAllRendering(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 surface_layer2_->SetReplicaLayer(replica_layer2_.get()); | 1487 surface_layer2_->SetReplicaLayer(replica_layer2_.get()); |
1473 | 1488 |
1474 layer_tree_host()->SetRootLayer(root_layer_); | 1489 layer_tree_host()->SetRootLayer(root_layer_); |
1475 LayerTreeHostTest::SetupTree(); | 1490 LayerTreeHostTest::SetupTree(); |
1476 } | 1491 } |
1477 | 1492 |
1478 virtual void BeginTest() OVERRIDE { | 1493 virtual void BeginTest() OVERRIDE { |
1479 PostSetNeedsCommitToMainThread(); | 1494 PostSetNeedsCommitToMainThread(); |
1480 } | 1495 } |
1481 | 1496 |
| 1497 virtual void DidActivateTreeOnThread(LayerTreeHostImpl *host_impl) { |
| 1498 // Reduce the memory limit to only fit the root layer and one render |
| 1499 // surface. This prevents any contents drawing into surfaces |
| 1500 // from being allocated. |
| 1501 if (host_impl->active_tree()->source_frame_number() == 0) { |
| 1502 host_impl->SetMemoryPolicy( |
| 1503 ManagedMemoryPolicy(100 * 100 * 4 * 2), true); |
| 1504 } |
| 1505 } |
| 1506 |
1482 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 1507 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
1483 Renderer* renderer = host_impl->renderer(); | 1508 Renderer* renderer = host_impl->renderer(); |
1484 RenderPass::Id surface1_render_pass_id = host_impl->active_tree() | 1509 RenderPass::Id surface1_render_pass_id = host_impl->active_tree() |
1485 ->root_layer()->children()[0]->render_surface()->RenderPassId(); | 1510 ->root_layer()->children()[0]->render_surface()->RenderPassId(); |
1486 RenderPass::Id surface2_render_pass_id = | 1511 RenderPass::Id surface2_render_pass_id = |
1487 host_impl->active_tree()->root_layer()->children()[0]->children()[0] | 1512 host_impl->active_tree()->root_layer()->children()[0]->children()[0] |
1488 ->render_surface()->RenderPassId(); | 1513 ->render_surface()->RenderPassId(); |
1489 | 1514 |
1490 switch (host_impl->active_tree()->source_frame_number()) { | 1515 switch (host_impl->active_tree()->source_frame_number()) { |
1491 case 0: | 1516 case 0: |
1492 EXPECT_TRUE(renderer->HaveCachedResourcesForRenderPassId( | 1517 EXPECT_TRUE(renderer->HaveCachedResourcesForRenderPassId( |
1493 surface1_render_pass_id)); | 1518 surface1_render_pass_id)); |
1494 EXPECT_TRUE(renderer->HaveCachedResourcesForRenderPassId( | 1519 EXPECT_TRUE(renderer->HaveCachedResourcesForRenderPassId( |
1495 surface2_render_pass_id)); | 1520 surface2_render_pass_id)); |
1496 | |
1497 // Reduce the memory limit to only fit the root layer and one render | |
1498 // surface. This prevents any contents drawing into surfaces | |
1499 // from being allocated. | |
1500 host_impl->SetMemoryPolicy( | |
1501 ManagedMemoryPolicy(100 * 100 * 4 * 2), true); | |
1502 break; | 1521 break; |
1503 case 1: | 1522 case 1: |
1504 EXPECT_FALSE(renderer->HaveCachedResourcesForRenderPassId( | 1523 EXPECT_FALSE(renderer->HaveCachedResourcesForRenderPassId( |
1505 surface1_render_pass_id)); | 1524 surface1_render_pass_id)); |
1506 EXPECT_FALSE(renderer->HaveCachedResourcesForRenderPassId( | 1525 EXPECT_FALSE(renderer->HaveCachedResourcesForRenderPassId( |
1507 surface2_render_pass_id)); | 1526 surface2_render_pass_id)); |
1508 | |
1509 EndTest(); | 1527 EndTest(); |
1510 break; | 1528 break; |
1511 } | 1529 } |
1512 } | 1530 } |
1513 | 1531 |
1514 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1532 virtual void DidCommit() OVERRIDE { |
1515 if (layer_tree_host()->source_frame_number() < 2) | 1533 if (layer_tree_host()->source_frame_number() < 2) |
1516 root_layer_->SetNeedsDisplay(); | 1534 root_layer_->SetNeedsDisplay(); |
1517 } | 1535 } |
1518 | 1536 |
1519 virtual void AfterTest() OVERRIDE { | 1537 virtual void AfterTest() OVERRIDE { |
1520 EXPECT_LE(2u, root_layer_->update_count()); | 1538 EXPECT_LE(2u, root_layer_->update_count()); |
1521 EXPECT_LE(2u, surface_layer1_->update_count()); | 1539 EXPECT_LE(2u, surface_layer1_->update_count()); |
1522 EXPECT_LE(2u, surface_layer2_->update_count()); | 1540 EXPECT_LE(2u, surface_layer2_->update_count()); |
1523 } | 1541 } |
1524 | 1542 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 content_layer_ = ContentLayer::Create(&client_); | 1828 content_layer_ = ContentLayer::Create(&client_); |
1811 content_layer_->SetBounds(gfx::Size(10, 10)); | 1829 content_layer_->SetBounds(gfx::Size(10, 10)); |
1812 content_layer_->SetPosition(gfx::PointF(0.f, 0.f)); | 1830 content_layer_->SetPosition(gfx::PointF(0.f, 0.f)); |
1813 content_layer_->SetAnchorPoint(gfx::PointF(0.f, 0.f)); | 1831 content_layer_->SetAnchorPoint(gfx::PointF(0.f, 0.f)); |
1814 content_layer_->SetIsDrawable(true); | 1832 content_layer_->SetIsDrawable(true); |
1815 layer_tree_host()->root_layer()->AddChild(content_layer_); | 1833 layer_tree_host()->root_layer()->AddChild(content_layer_); |
1816 | 1834 |
1817 PostSetNeedsCommitToMainThread(); | 1835 PostSetNeedsCommitToMainThread(); |
1818 } | 1836 } |
1819 | 1837 |
1820 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1838 virtual void DidCommit() OVERRIDE { |
1821 if (num_draw_layers_ == 2) | 1839 if (num_draw_layers_ == 2) |
1822 return; | 1840 return; |
1823 content_layer_->SetNeedsDisplay(); | 1841 content_layer_->SetNeedsDisplay(); |
1824 } | 1842 } |
1825 | 1843 |
1826 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 1844 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
1827 if (num_draw_layers_ == 1) | 1845 if (num_draw_layers_ == 1) |
1828 num_commit_complete_++; | 1846 num_commit_complete_++; |
1829 } | 1847 } |
1830 | 1848 |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2206 settings->begin_frame_scheduling_enabled = true; | 2224 settings->begin_frame_scheduling_enabled = true; |
2207 settings->using_synchronous_renderer_compositor = true; | 2225 settings->using_synchronous_renderer_compositor = true; |
2208 } | 2226 } |
2209 | 2227 |
2210 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 2228 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
2211 | 2229 |
2212 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 2230 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
2213 // The BeginFrame notification is turned off now but will get enabled | 2231 // The BeginFrame notification is turned off now but will get enabled |
2214 // once we return. End test while it's enabled. | 2232 // once we return. End test while it's enabled. |
2215 ImplThreadTaskRunner()->PostTask( | 2233 ImplThreadTaskRunner()->PostTask( |
2216 FROM_HERE, | 2234 FROM_HERE, base::Bind( |
2217 base::Bind(&LayerTreeHostTestBeginFrameNotification::EndTest, | 2235 &LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled::EndTest, |
2218 base::Unretained(this))); | 2236 base::Unretained(this))); |
2219 } | 2237 } |
2220 | 2238 |
2221 virtual void AfterTest() OVERRIDE {} | 2239 virtual void AfterTest() OVERRIDE {} |
2222 }; | 2240 }; |
2223 | 2241 |
2224 MULTI_THREAD_TEST_F( | 2242 MULTI_THREAD_TEST_F( |
2225 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); | 2243 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); |
2226 | 2244 |
2227 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation | 2245 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation |
2228 : public LayerTreeHostTest { | 2246 : public LayerTreeHostTest { |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2460 root->AddChild(child); | 2478 root->AddChild(child); |
2461 | 2479 |
2462 layer_tree_host()->SetRootLayer(root); | 2480 layer_tree_host()->SetRootLayer(root); |
2463 LayerTreeHostTest::SetupTree(); | 2481 LayerTreeHostTest::SetupTree(); |
2464 } | 2482 } |
2465 | 2483 |
2466 virtual void BeginTest() OVERRIDE { | 2484 virtual void BeginTest() OVERRIDE { |
2467 PostSetNeedsCommitToMainThread(); | 2485 PostSetNeedsCommitToMainThread(); |
2468 } | 2486 } |
2469 | 2487 |
2470 virtual void DidCommitAndDrawFrame() OVERRIDE { | 2488 virtual void DidCommit() OVERRIDE { |
2471 WaitForCallback(); | 2489 WaitForCallback(); |
2472 } | 2490 } |
2473 | 2491 |
2474 void WaitForCallback() { | 2492 void WaitForCallback() { |
2475 base::MessageLoop::current()->PostTask( | 2493 base::MessageLoop::current()->PostTask( |
2476 FROM_HERE, | 2494 FROM_HERE, |
2477 base::Bind( | 2495 base::Bind( |
2478 &LayerTreeHostTestAsyncReadback::NextStep, | 2496 &LayerTreeHostTestAsyncReadback::NextStep, |
2479 base::Unretained(this))); | 2497 base::Unretained(this))); |
2480 } | 2498 } |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3002 layer_tree_host()->SetNeedsRedraw(); | 3020 layer_tree_host()->SetNeedsRedraw(); |
3003 break; | 3021 break; |
3004 case 3: | 3022 case 3: |
3005 // CompositeAndReadback in Round 4, first commit. | 3023 // CompositeAndReadback in Round 4, first commit. |
3006 EXPECT_EQ(2, frame_); | 3024 EXPECT_EQ(2, frame_); |
3007 break; | 3025 break; |
3008 case 4: | 3026 case 4: |
3009 // Round 4 done. | 3027 // Round 4 done. |
3010 EXPECT_EQ(2, frame_); | 3028 EXPECT_EQ(2, frame_); |
3011 layer_tree_host()->SetNeedsCommit(); | 3029 layer_tree_host()->SetNeedsCommit(); |
| 3030 // We cant SetNeedsRedraw immediately because it will race the commit. |
| 3031 break; |
| 3032 case 5: |
| 3033 EXPECT_EQ(2, frame_); |
3012 layer_tree_host()->SetNeedsRedraw(); | 3034 layer_tree_host()->SetNeedsRedraw(); |
3013 break; | 3035 break; |
3014 } | 3036 } |
3015 } | 3037 } |
3016 | 3038 |
3017 virtual void DidCompleteSwapBuffers() OVERRIDE { | 3039 virtual void DidCompleteSwapBuffers() OVERRIDE { |
3018 int commit = layer_tree_host()->source_frame_number(); | 3040 int commit = layer_tree_host()->source_frame_number(); |
3019 ++frame_; | 3041 ++frame_; |
3020 char pixels[4] = {0}; | 3042 char pixels[4] = {0}; |
3021 switch (frame_) { | 3043 switch (frame_) { |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3316 root_->AddChild(child2_); | 3338 root_->AddChild(child2_); |
3317 child_->AddChild(grandchild_); | 3339 child_->AddChild(grandchild_); |
3318 child2_->AddChild(leaf_scrollbar_layer_); | 3340 child2_->AddChild(leaf_scrollbar_layer_); |
3319 | 3341 |
3320 other_root_ = PushPropertiesCountingLayer::Create(); | 3342 other_root_ = PushPropertiesCountingLayer::Create(); |
3321 | 3343 |
3322 // Don't set the root layer here. | 3344 // Don't set the root layer here. |
3323 LayerTreeHostTest::SetupTree(); | 3345 LayerTreeHostTest::SetupTree(); |
3324 } | 3346 } |
3325 | 3347 |
3326 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3348 virtual void DidCommit() OVERRIDE { |
3327 ++num_commits_; | 3349 ++num_commits_; |
3328 | 3350 |
3329 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count()); | 3351 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count()); |
3330 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count()); | 3352 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count()); |
3331 EXPECT_EQ(expected_push_properties_grandchild_, | 3353 EXPECT_EQ(expected_push_properties_grandchild_, |
3332 grandchild_->push_properties_count()); | 3354 grandchild_->push_properties_count()); |
3333 EXPECT_EQ(expected_push_properties_child2_, | 3355 EXPECT_EQ(expected_push_properties_child2_, |
3334 child2_->push_properties_count()); | 3356 child2_->push_properties_count()); |
3335 EXPECT_EQ(expected_push_properties_other_root_, | 3357 EXPECT_EQ(expected_push_properties_other_root_, |
3336 other_root_->push_properties_count()); | 3358 other_root_->push_properties_count()); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3498 bool has_thumb = false; | 3520 bool has_thumb = false; |
3499 scrollbar_layer_ = | 3521 scrollbar_layer_ = |
3500 FakeScrollbarLayer::Create(paint_scrollbar, has_thumb, root_->id()); | 3522 FakeScrollbarLayer::Create(paint_scrollbar, has_thumb, root_->id()); |
3501 | 3523 |
3502 root_->AddChild(scrollbar_layer_); | 3524 root_->AddChild(scrollbar_layer_); |
3503 | 3525 |
3504 layer_tree_host()->SetRootLayer(root_); | 3526 layer_tree_host()->SetRootLayer(root_); |
3505 LayerTreeHostTest::SetupTree(); | 3527 LayerTreeHostTest::SetupTree(); |
3506 } | 3528 } |
3507 | 3529 |
3508 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3530 virtual void DidCommit() OVERRIDE { |
3509 switch (layer_tree_host()->source_frame_number()) { | 3531 switch (layer_tree_host()->source_frame_number()) { |
3510 case 0: | 3532 case 0: |
3511 break; | 3533 break; |
3512 case 1: { | 3534 case 1: { |
3513 // During update, the ignore_set_needs_commit_ bit is set to true to | 3535 // During update, the ignore_set_needs_commit_ bit is set to true to |
3514 // avoid causing a second commit to be scheduled. If a property change | 3536 // avoid causing a second commit to be scheduled. If a property change |
3515 // is made during this, however, it needs to be pushed in the upcoming | 3537 // is made during this, however, it needs to be pushed in the upcoming |
3516 // commit. | 3538 // commit. |
3517 scoped_ptr<base::AutoReset<bool> > ignore = | 3539 scoped_ptr<base::AutoReset<bool> > ignore = |
3518 scrollbar_layer_->IgnoreSetNeedsCommit(); | 3540 scrollbar_layer_->IgnoreSetNeedsCommit(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3581 size_t expected_push_properties_root_; | 3603 size_t expected_push_properties_root_; |
3582 size_t expected_push_properties_child_; | 3604 size_t expected_push_properties_child_; |
3583 size_t expected_push_properties_grandchild1_; | 3605 size_t expected_push_properties_grandchild1_; |
3584 size_t expected_push_properties_grandchild2_; | 3606 size_t expected_push_properties_grandchild2_; |
3585 size_t expected_push_properties_grandchild3_; | 3607 size_t expected_push_properties_grandchild3_; |
3586 }; | 3608 }; |
3587 | 3609 |
3588 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush | 3610 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush |
3589 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3611 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3590 protected: | 3612 protected: |
3591 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3613 virtual void DidCommit() OVERRIDE { |
3592 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3614 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3593 switch (last_source_frame_number) { | 3615 switch (last_source_frame_number) { |
3594 case 0: | 3616 case 0: |
3595 EXPECT_FALSE(root_->needs_push_properties()); | 3617 EXPECT_FALSE(root_->needs_push_properties()); |
3596 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3618 EXPECT_FALSE(root_->descendant_needs_push_properties()); |
3597 EXPECT_FALSE(child_->needs_push_properties()); | 3619 EXPECT_FALSE(child_->needs_push_properties()); |
3598 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3620 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
3599 EXPECT_FALSE(grandchild1_->needs_push_properties()); | 3621 EXPECT_FALSE(grandchild1_->needs_push_properties()); |
3600 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3622 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); |
3601 EXPECT_FALSE(grandchild2_->needs_push_properties()); | 3623 EXPECT_FALSE(grandchild2_->needs_push_properties()); |
(...skipping 19 matching lines...) Expand all Loading... |
3621 break; | 3643 break; |
3622 } | 3644 } |
3623 } | 3645 } |
3624 }; | 3646 }; |
3625 | 3647 |
3626 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); | 3648 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); |
3627 | 3649 |
3628 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion | 3650 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion |
3629 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3651 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3630 protected: | 3652 protected: |
3631 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3653 virtual void DidCommit() OVERRIDE { |
3632 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3654 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3633 switch (last_source_frame_number) { | 3655 switch (last_source_frame_number) { |
3634 case 0: | 3656 case 0: |
3635 layer_tree_host()->SetRootLayer(root_); | 3657 layer_tree_host()->SetRootLayer(root_); |
3636 break; | 3658 break; |
3637 case 1: | 3659 case 1: |
3638 EXPECT_FALSE(root_->needs_push_properties()); | 3660 EXPECT_FALSE(root_->needs_push_properties()); |
3639 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3661 EXPECT_FALSE(root_->descendant_needs_push_properties()); |
3640 EXPECT_FALSE(child_->needs_push_properties()); | 3662 EXPECT_FALSE(child_->needs_push_properties()); |
3641 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3663 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3704 break; | 3726 break; |
3705 } | 3727 } |
3706 } | 3728 } |
3707 }; | 3729 }; |
3708 | 3730 |
3709 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); | 3731 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); |
3710 | 3732 |
3711 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence | 3733 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence |
3712 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3734 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3713 protected: | 3735 protected: |
3714 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3736 virtual void DidCommit() OVERRIDE { |
3715 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3737 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3716 switch (last_source_frame_number) { | 3738 switch (last_source_frame_number) { |
3717 case 0: | 3739 case 0: |
3718 layer_tree_host()->SetRootLayer(root_); | 3740 layer_tree_host()->SetRootLayer(root_); |
3719 grandchild1_->set_persist_needs_push_properties(true); | 3741 grandchild1_->set_persist_needs_push_properties(true); |
3720 grandchild2_->set_persist_needs_push_properties(true); | 3742 grandchild2_->set_persist_needs_push_properties(true); |
3721 break; | 3743 break; |
3722 case 1: | 3744 case 1: |
3723 EXPECT_FALSE(root_->needs_push_properties()); | 3745 EXPECT_FALSE(root_->needs_push_properties()); |
3724 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3746 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
(...skipping 27 matching lines...) Expand all Loading... |
3752 } | 3774 } |
3753 } | 3775 } |
3754 }; | 3776 }; |
3755 | 3777 |
3756 MULTI_THREAD_TEST_F( | 3778 MULTI_THREAD_TEST_F( |
3757 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); | 3779 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); |
3758 | 3780 |
3759 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree | 3781 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree |
3760 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3782 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3761 protected: | 3783 protected: |
3762 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3784 virtual void DidCommit() OVERRIDE { |
3763 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3785 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3764 switch (last_source_frame_number) { | 3786 switch (last_source_frame_number) { |
3765 case 0: | 3787 case 0: |
3766 layer_tree_host()->SetRootLayer(root_); | 3788 layer_tree_host()->SetRootLayer(root_); |
3767 break; | 3789 break; |
3768 case 1: | 3790 case 1: |
3769 EXPECT_FALSE(root_->needs_push_properties()); | 3791 EXPECT_FALSE(root_->needs_push_properties()); |
3770 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3792 EXPECT_FALSE(root_->descendant_needs_push_properties()); |
3771 EXPECT_FALSE(child_->needs_push_properties()); | 3793 EXPECT_FALSE(child_->needs_push_properties()); |
3772 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3794 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3820 } | 3842 } |
3821 } | 3843 } |
3822 }; | 3844 }; |
3823 | 3845 |
3824 MULTI_THREAD_TEST_F( | 3846 MULTI_THREAD_TEST_F( |
3825 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); | 3847 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); |
3826 | 3848 |
3827 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild | 3849 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild |
3828 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3850 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3829 protected: | 3851 protected: |
3830 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3852 virtual void DidCommit() OVERRIDE { |
3831 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3853 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3832 switch (last_source_frame_number) { | 3854 switch (last_source_frame_number) { |
3833 case 0: | 3855 case 0: |
3834 layer_tree_host()->SetRootLayer(root_); | 3856 layer_tree_host()->SetRootLayer(root_); |
3835 break; | 3857 break; |
3836 case 1: | 3858 case 1: |
3837 EXPECT_FALSE(root_->needs_push_properties()); | 3859 EXPECT_FALSE(root_->needs_push_properties()); |
3838 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3860 EXPECT_FALSE(root_->descendant_needs_push_properties()); |
3839 EXPECT_FALSE(child_->needs_push_properties()); | 3861 EXPECT_FALSE(child_->needs_push_properties()); |
3840 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3862 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3884 } | 3906 } |
3885 } | 3907 } |
3886 }; | 3908 }; |
3887 | 3909 |
3888 MULTI_THREAD_TEST_F( | 3910 MULTI_THREAD_TEST_F( |
3889 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); | 3911 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); |
3890 | 3912 |
3891 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent | 3913 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent |
3892 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3914 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3893 protected: | 3915 protected: |
3894 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3916 virtual void DidCommit() OVERRIDE { |
3895 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3917 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3896 switch (last_source_frame_number) { | 3918 switch (last_source_frame_number) { |
3897 case 0: | 3919 case 0: |
3898 layer_tree_host()->SetRootLayer(root_); | 3920 layer_tree_host()->SetRootLayer(root_); |
3899 break; | 3921 break; |
3900 case 1: | 3922 case 1: |
3901 EXPECT_FALSE(root_->needs_push_properties()); | 3923 EXPECT_FALSE(root_->needs_push_properties()); |
3902 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3924 EXPECT_FALSE(root_->descendant_needs_push_properties()); |
3903 EXPECT_FALSE(child_->needs_push_properties()); | 3925 EXPECT_FALSE(child_->needs_push_properties()); |
3904 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3926 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4016 TEST_F(LayerTreeHostTestTreeActivationCallback, DirectRenderer) { | 4038 TEST_F(LayerTreeHostTestTreeActivationCallback, DirectRenderer) { |
4017 RunTest(true, false, true); | 4039 RunTest(true, false, true); |
4018 } | 4040 } |
4019 | 4041 |
4020 TEST_F(LayerTreeHostTestTreeActivationCallback, DelegatingRenderer) { | 4042 TEST_F(LayerTreeHostTestTreeActivationCallback, DelegatingRenderer) { |
4021 RunTest(true, true, true); | 4043 RunTest(true, true, true); |
4022 } | 4044 } |
4023 | 4045 |
4024 } // namespace | 4046 } // namespace |
4025 } // namespace cc | 4047 } // namespace cc |
OLD | NEW |