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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 void AfterTest() override { | 135 void AfterTest() override { |
136 EXPECT_TRUE(did_notify_ready_to_activate_); | 136 EXPECT_TRUE(did_notify_ready_to_activate_); |
137 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); | 137 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); |
138 EXPECT_LE(size_t(1), required_for_activation_count_); | 138 EXPECT_LE(size_t(1), required_for_activation_count_); |
139 } | 139 } |
140 | 140 |
141 private: | 141 private: |
142 FakeContentLayerClient client_; | 142 FakeContentLayerClient client_; |
143 }; | 143 }; |
144 | 144 |
145 SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToActivateNonEmpty); | 145 // Multi-thread only because in single thread the commit goes directly to the |
| 146 // active tree, so notify ready to activate is skipped. |
| 147 MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestReadyToActivateNonEmpty); |
146 | 148 |
147 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when | 149 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when |
148 // no raster tasks get scheduled. | 150 // no raster tasks get scheduled. |
149 class LayerTreeHostTestReadyToDrawEmpty : public LayerTreeHostTest { | 151 class LayerTreeHostTestReadyToDrawEmpty : public LayerTreeHostTest { |
150 public: | 152 public: |
151 LayerTreeHostTestReadyToDrawEmpty() | 153 LayerTreeHostTestReadyToDrawEmpty() |
152 : did_notify_ready_to_draw_(false), | 154 : did_notify_ready_to_draw_(false), |
153 all_tiles_required_for_draw_are_ready_to_draw_(false), | 155 all_tiles_required_for_draw_are_ready_to_draw_(false), |
154 required_for_draw_count_(0) {} | 156 required_for_draw_count_(0) {} |
155 | 157 |
(...skipping 5036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5192 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); | 5194 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); |
5193 // Veto will take effect when layers are updated. | 5195 // Veto will take effect when layers are updated. |
5194 // The results will be verified after commit is completed below. | 5196 // The results will be verified after commit is completed below. |
5195 // Since we are manually marking picture pile as unsuitable, | 5197 // Since we are manually marking picture pile as unsuitable, |
5196 // make sure that the layer gets a chance to update. | 5198 // make sure that the layer gets a chance to update. |
5197 layer->SetNeedsDisplay(); | 5199 layer->SetNeedsDisplay(); |
5198 PostSetNeedsCommitToMainThread(); | 5200 PostSetNeedsCommitToMainThread(); |
5199 } | 5201 } |
5200 | 5202 |
5201 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 5203 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
5202 EXPECT_TRUE(host_impl->pending_tree()->use_gpu_rasterization()); | 5204 EXPECT_TRUE(host_impl->sync_tree()->use_gpu_rasterization()); |
5203 EXPECT_TRUE(host_impl->use_gpu_rasterization()); | 5205 EXPECT_TRUE(host_impl->use_gpu_rasterization()); |
5204 } | 5206 } |
5205 | 5207 |
5206 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 5208 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
5207 EXPECT_TRUE(host_impl->active_tree()->use_gpu_rasterization()); | 5209 EXPECT_TRUE(host_impl->active_tree()->use_gpu_rasterization()); |
5208 EXPECT_TRUE(host_impl->use_gpu_rasterization()); | 5210 EXPECT_TRUE(host_impl->use_gpu_rasterization()); |
5209 EndTest(); | 5211 EndTest(); |
5210 } | 5212 } |
5211 | 5213 |
5212 void AfterTest() override {} | 5214 void AfterTest() override {} |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6312 | 6314 |
6313 void AfterTest() override { EXPECT_TRUE(did_commit_); } | 6315 void AfterTest() override { EXPECT_TRUE(did_commit_); } |
6314 | 6316 |
6315 private: | 6317 private: |
6316 bool did_commit_; | 6318 bool did_commit_; |
6317 }; | 6319 }; |
6318 | 6320 |
6319 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); | 6321 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); |
6320 | 6322 |
6321 } // namespace cc | 6323 } // namespace cc |
OLD | NEW |