| 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/location.h" | 10 #include "base/location.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 LayerTreeHostTest() : contents_texture_manager_(nullptr) {} | 79 LayerTreeHostTest() : contents_texture_manager_(nullptr) {} |
| 80 | 80 |
| 81 void DidInitializeOutputSurface() override { | 81 void DidInitializeOutputSurface() override { |
| 82 contents_texture_manager_ = layer_tree_host()->contents_texture_manager(); | 82 contents_texture_manager_ = layer_tree_host()->contents_texture_manager(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 protected: | 85 protected: |
| 86 PrioritizedResourceManager* contents_texture_manager_; | 86 PrioritizedResourceManager* contents_texture_manager_; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 class LayerTreeHostTestSetNeedsCommitInsideLayout : public LayerTreeHostTest { |
| 90 protected: |
| 91 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 92 |
| 93 void Layout() override { |
| 94 // This shouldn't cause a second commit to happen. |
| 95 layer_tree_host()->SetNeedsCommit(); |
| 96 } |
| 97 |
| 98 void DidCommit() override { |
| 99 EXPECT_EQ(1, layer_tree_host()->source_frame_number()); |
| 100 EndTest(); |
| 101 } |
| 102 |
| 103 void AfterTest() override {} |
| 104 }; |
| 105 |
| 106 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F( |
| 107 LayerTreeHostTestSetNeedsCommitInsideLayout); |
| 108 |
| 109 class LayerTreeHostTestSetNeedsUpdateInsideLayout : public LayerTreeHostTest { |
| 110 protected: |
| 111 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 112 |
| 113 void Layout() override { |
| 114 // This shouldn't cause a second commit to happen. |
| 115 layer_tree_host()->SetNeedsUpdateLayers(); |
| 116 } |
| 117 |
| 118 void DidCommit() override { |
| 119 EXPECT_EQ(1, layer_tree_host()->source_frame_number()); |
| 120 EndTest(); |
| 121 } |
| 122 |
| 123 void AfterTest() override {} |
| 124 }; |
| 125 |
| 126 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F( |
| 127 LayerTreeHostTestSetNeedsUpdateInsideLayout); |
| 128 |
| 89 // Test if the LTHI receives ReadyToActivate notifications from the TileManager | 129 // Test if the LTHI receives ReadyToActivate notifications from the TileManager |
| 90 // when no raster tasks get scheduled. | 130 // when no raster tasks get scheduled. |
| 91 class LayerTreeHostTestReadyToActivateEmpty : public LayerTreeHostTest { | 131 class LayerTreeHostTestReadyToActivateEmpty : public LayerTreeHostTest { |
| 92 public: | 132 public: |
| 93 LayerTreeHostTestReadyToActivateEmpty() | 133 LayerTreeHostTestReadyToActivateEmpty() |
| 94 : did_notify_ready_to_activate_(false), | 134 : did_notify_ready_to_activate_(false), |
| 95 all_tiles_required_for_activation_are_ready_to_draw_(false), | 135 all_tiles_required_for_activation_are_ready_to_draw_(false), |
| 96 required_for_activation_count_(0) {} | 136 required_for_activation_count_(0) {} |
| 97 | 137 |
| 98 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 138 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| (...skipping 6853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6952 void AfterTest() override {} | 6992 void AfterTest() override {} |
| 6953 | 6993 |
| 6954 scoped_refptr<FakePictureLayer> content_child_layer_; | 6994 scoped_refptr<FakePictureLayer> content_child_layer_; |
| 6955 FakeContentLayerClient client_; | 6995 FakeContentLayerClient client_; |
| 6956 }; | 6996 }; |
| 6957 | 6997 |
| 6958 SINGLE_AND_MULTI_THREAD_TEST_F( | 6998 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 6959 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild); | 6999 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild); |
| 6960 | 7000 |
| 6961 } // namespace cc | 7001 } // namespace cc |
| OLD | NEW |