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 5152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5163 int num_draws_; | 5163 int num_draws_; |
5164 const gfx::Size bounds_; | 5164 const gfx::Size bounds_; |
5165 FakeContentLayerClient client_; | 5165 FakeContentLayerClient client_; |
5166 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 5166 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
5167 scoped_refptr<FakePictureLayer> picture_layer_; | 5167 scoped_refptr<FakePictureLayer> picture_layer_; |
5168 Layer* child_layer_; | 5168 Layer* child_layer_; |
5169 }; | 5169 }; |
5170 | 5170 |
5171 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 5171 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
5172 | 5172 |
| 5173 class LayerTreeHostTestSendBeginFramesToChildren : public LayerTreeHostTest { |
| 5174 public: |
| 5175 LayerTreeHostTestSendBeginFramesToChildren() |
| 5176 : begin_frame_sent_to_children_(false) { |
| 5177 } |
| 5178 |
| 5179 void InitializeSettings(LayerTreeSettings* settings) override { |
| 5180 settings->forward_begin_frames_to_children = true; |
| 5181 } |
| 5182 |
| 5183 void BeginTest() override { |
| 5184 // Kick off the test with a commit. |
| 5185 PostSetNeedsCommitToMainThread(); |
| 5186 } |
| 5187 |
| 5188 void SendBeginFramesToChildren(const BeginFrameArgs& args) override { |
| 5189 begin_frame_sent_to_children_ = true; |
| 5190 EndTest(); |
| 5191 } |
| 5192 |
| 5193 void DidBeginMainFrame() override { |
| 5194 // Children requested BeginFrames. |
| 5195 layer_tree_host()->SetChildrenNeedBeginFrames(true); |
| 5196 } |
| 5197 |
| 5198 void AfterTest() override { |
| 5199 // Ensure that BeginFrame message is sent to children during parent |
| 5200 // scheduler handles its BeginFrame. |
| 5201 EXPECT_TRUE(begin_frame_sent_to_children_); |
| 5202 } |
| 5203 |
| 5204 private: |
| 5205 bool begin_frame_sent_to_children_; |
| 5206 }; |
| 5207 |
| 5208 SINGLE_THREAD_TEST_F(LayerTreeHostTestSendBeginFramesToChildren); |
| 5209 |
| 5210 class LayerTreeHostTestSendBeginFramesToChildrenWithExternalBFS |
| 5211 : public LayerTreeHostTest { |
| 5212 public: |
| 5213 LayerTreeHostTestSendBeginFramesToChildrenWithExternalBFS() |
| 5214 : begin_frame_sent_to_children_(false) { |
| 5215 } |
| 5216 |
| 5217 void InitializeSettings(LayerTreeSettings* settings) override { |
| 5218 settings->use_external_begin_frame_source = true; |
| 5219 settings->forward_begin_frames_to_children = true; |
| 5220 } |
| 5221 |
| 5222 void BeginTest() override { |
| 5223 // Kick off the test with a commit. |
| 5224 PostSetNeedsCommitToMainThread(); |
| 5225 } |
| 5226 |
| 5227 void SendBeginFramesToChildren(const BeginFrameArgs& args) override { |
| 5228 begin_frame_sent_to_children_ = true; |
| 5229 EndTest(); |
| 5230 } |
| 5231 |
| 5232 void DidBeginMainFrame() override { |
| 5233 // Children requested BeginFrames. |
| 5234 layer_tree_host()->SetChildrenNeedBeginFrames(true); |
| 5235 } |
| 5236 |
| 5237 void AfterTest() override { |
| 5238 // Ensure that BeginFrame message is sent to children during parent |
| 5239 // scheduler handles its BeginFrame. |
| 5240 EXPECT_TRUE(begin_frame_sent_to_children_); |
| 5241 } |
| 5242 |
| 5243 private: |
| 5244 bool begin_frame_sent_to_children_; |
| 5245 }; |
| 5246 |
| 5247 SINGLE_THREAD_TEST_F(LayerTreeHostTestSendBeginFramesToChildrenWithExternalBFS); |
| 5248 |
5173 class LayerTreeHostTestActivateOnInvisible : public LayerTreeHostTest { | 5249 class LayerTreeHostTestActivateOnInvisible : public LayerTreeHostTest { |
5174 public: | 5250 public: |
5175 LayerTreeHostTestActivateOnInvisible() | 5251 LayerTreeHostTestActivateOnInvisible() |
5176 : activation_count_(0), visible_(true) {} | 5252 : activation_count_(0), visible_(true) {} |
5177 | 5253 |
5178 void InitializeSettings(LayerTreeSettings* settings) override { | 5254 void InitializeSettings(LayerTreeSettings* settings) override { |
5179 settings->impl_side_painting = true; | 5255 settings->impl_side_painting = true; |
5180 } | 5256 } |
5181 | 5257 |
5182 void BeginTest() override { | 5258 void BeginTest() override { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5348 void AfterTest() override { | 5424 void AfterTest() override { |
5349 EXPECT_TRUE(deltas_sent_to_client_); | 5425 EXPECT_TRUE(deltas_sent_to_client_); |
5350 } | 5426 } |
5351 | 5427 |
5352 ScrollAndScaleSet info_; | 5428 ScrollAndScaleSet info_; |
5353 bool deltas_sent_to_client_; | 5429 bool deltas_sent_to_client_; |
5354 }; | 5430 }; |
5355 | 5431 |
5356 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer); | 5432 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer); |
5357 } // namespace cc | 5433 } // namespace cc |
OLD | NEW |