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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 reduce_memory_result_(true), | 104 reduce_memory_result_(true), |
105 skip_draw_layers_in_on_draw_(false) { | 105 skip_draw_layers_in_on_draw_(false) { |
106 media::InitializeMediaLibrary(); | 106 media::InitializeMediaLibrary(); |
107 } | 107 } |
108 | 108 |
109 LayerTreeSettings DefaultSettings() { | 109 LayerTreeSettings DefaultSettings() { |
110 LayerTreeSettings settings; | 110 LayerTreeSettings settings; |
111 settings.minimum_occlusion_tracking_size = gfx::Size(); | 111 settings.minimum_occlusion_tracking_size = gfx::Size(); |
112 settings.renderer_settings.texture_id_allocation_chunk_size = 1; | 112 settings.renderer_settings.texture_id_allocation_chunk_size = 1; |
113 settings.gpu_rasterization_enabled = true; | 113 settings.gpu_rasterization_enabled = true; |
114 settings.use_compositor_animation_timelines = true; | |
115 return settings; | 114 return settings; |
116 } | 115 } |
117 | 116 |
118 void SetUp() override { | 117 void SetUp() override { |
119 CreateHostImpl(DefaultSettings(), CreateOutputSurface()); | 118 CreateHostImpl(DefaultSettings(), CreateOutputSurface()); |
120 } | 119 } |
121 | 120 |
122 void TearDown() override {} | 121 void TearDown() override {} |
123 | 122 |
124 void UpdateRendererCapabilitiesOnImplThread() override {} | 123 void UpdateRendererCapabilitiesOnImplThread() override {} |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 bool skip_draw_layers_in_on_draw_; | 501 bool skip_draw_layers_in_on_draw_; |
503 scoped_ptr<LayerTreeHostImpl::FrameData> last_on_draw_frame_; | 502 scoped_ptr<LayerTreeHostImpl::FrameData> last_on_draw_frame_; |
504 RenderPassList last_on_draw_render_passes_; | 503 RenderPassList last_on_draw_render_passes_; |
505 scoped_refptr<AnimationTimeline> timeline_; | 504 scoped_refptr<AnimationTimeline> timeline_; |
506 }; | 505 }; |
507 | 506 |
508 // A test fixture for new animation timelines tests. | 507 // A test fixture for new animation timelines tests. |
509 class LayerTreeHostImplTimelinesTest : public LayerTreeHostImplTest { | 508 class LayerTreeHostImplTimelinesTest : public LayerTreeHostImplTest { |
510 public: | 509 public: |
511 void SetUp() override { | 510 void SetUp() override { |
512 LayerTreeSettings settings = DefaultSettings(); | 511 CreateHostImpl(DefaultSettings(), CreateOutputSurface()); |
513 settings.use_compositor_animation_timelines = true; | |
514 CreateHostImpl(settings, CreateOutputSurface()); | |
515 } | 512 } |
516 }; | 513 }; |
517 | 514 |
518 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { | 515 TEST_F(LayerTreeHostImplTest, NotifyIfCanDrawChanged) { |
519 // Note: It is not possible to disable the renderer once it has been set, | 516 // Note: It is not possible to disable the renderer once it has been set, |
520 // so we do not need to test that disabling the renderer notifies us | 517 // so we do not need to test that disabling the renderer notifies us |
521 // that can_draw changed. | 518 // that can_draw changed. |
522 EXPECT_FALSE(host_impl_->CanDraw()); | 519 EXPECT_FALSE(host_impl_->CanDraw()); |
523 on_can_draw_state_changed_called_ = false; | 520 on_can_draw_state_changed_called_ = false; |
524 | 521 |
(...skipping 9775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10300 // There should not be any jitter measured till we hit the fixed point hits | 10297 // There should not be any jitter measured till we hit the fixed point hits |
10301 // threshold. | 10298 // threshold. |
10302 float expected_jitter = | 10299 float expected_jitter = |
10303 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; | 10300 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; |
10304 EXPECT_EQ(jitter, expected_jitter); | 10301 EXPECT_EQ(jitter, expected_jitter); |
10305 } | 10302 } |
10306 } | 10303 } |
10307 | 10304 |
10308 } // namespace | 10305 } // namespace |
10309 } // namespace cc | 10306 } // namespace cc |
OLD | NEW |