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 <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 using ::testing::_; | 74 using ::testing::_; |
75 using media::VideoFrame; | 75 using media::VideoFrame; |
76 | 76 |
77 namespace cc { | 77 namespace cc { |
78 namespace { | 78 namespace { |
79 | 79 |
80 class LayerTreeHostImplTest : public testing::Test, | 80 class LayerTreeHostImplTest : public testing::Test, |
81 public LayerTreeHostImplClient { | 81 public LayerTreeHostImplClient { |
82 public: | 82 public: |
83 LayerTreeHostImplTest() | 83 LayerTreeHostImplTest() |
84 : task_runner_provider_(base::ThreadTaskRunnerHandle::Get(), | 84 : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()), |
85 base::ThreadTaskRunnerHandle::Get()), | |
86 always_impl_thread_(&task_runner_provider_), | |
87 always_main_thread_blocked_(&task_runner_provider_), | 85 always_main_thread_blocked_(&task_runner_provider_), |
88 on_can_draw_state_changed_called_(false), | 86 on_can_draw_state_changed_called_(false), |
89 did_notify_ready_to_activate_(false), | 87 did_notify_ready_to_activate_(false), |
90 did_request_commit_(false), | 88 did_request_commit_(false), |
91 did_request_redraw_(false), | 89 did_request_redraw_(false), |
92 did_request_animate_(false), | 90 did_request_animate_(false), |
93 did_request_prepare_tiles_(false), | 91 did_request_prepare_tiles_(false), |
94 did_complete_page_scale_animation_(false), | 92 did_complete_page_scale_animation_(false), |
95 reduce_memory_result_(true) { | 93 reduce_memory_result_(true) { |
96 media::InitializeMediaLibrary(); | 94 media::InitializeMediaLibrary(); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 virtual scoped_ptr<OutputSurface> CreateOutputSurface() { | 420 virtual scoped_ptr<OutputSurface> CreateOutputSurface() { |
423 return FakeOutputSurface::Create3d(); | 421 return FakeOutputSurface::Create3d(); |
424 } | 422 } |
425 | 423 |
426 void DrawOneFrame() { | 424 void DrawOneFrame() { |
427 LayerTreeHostImpl::FrameData frame_data; | 425 LayerTreeHostImpl::FrameData frame_data; |
428 PrepareToDrawFrame(&frame_data); | 426 PrepareToDrawFrame(&frame_data); |
429 host_impl_->DidDrawAllLayers(frame_data); | 427 host_impl_->DidDrawAllLayers(frame_data); |
430 } | 428 } |
431 | 429 |
432 TaskRunnerProvider task_runner_provider_; | 430 FakeImplTaskRunnerProvider task_runner_provider_; |
433 DebugScopedSetImplThread always_impl_thread_; | |
434 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; | 431 DebugScopedSetMainThreadBlocked always_main_thread_blocked_; |
435 | 432 |
436 TestSharedBitmapManager shared_bitmap_manager_; | 433 TestSharedBitmapManager shared_bitmap_manager_; |
437 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; | 434 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; |
438 TestTaskGraphRunner task_graph_runner_; | 435 TestTaskGraphRunner task_graph_runner_; |
439 scoped_ptr<OutputSurface> output_surface_; | 436 scoped_ptr<OutputSurface> output_surface_; |
440 scoped_ptr<LayerTreeHostImpl> host_impl_; | 437 scoped_ptr<LayerTreeHostImpl> host_impl_; |
441 FakeRenderingStatsInstrumentation stats_instrumentation_; | 438 FakeRenderingStatsInstrumentation stats_instrumentation_; |
442 bool on_can_draw_state_changed_called_; | 439 bool on_can_draw_state_changed_called_; |
443 bool did_notify_ready_to_activate_; | 440 bool did_notify_ready_to_activate_; |
(...skipping 8623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9067 host_impl_->active_tree()->SetPageScaleOnActiveTree(2.f); | 9064 host_impl_->active_tree()->SetPageScaleOnActiveTree(2.f); |
9068 DrawFrame(); | 9065 DrawFrame(); |
9069 in_subtree_of_page_scale_layer = host_impl_->active_tree()->LayerById(100); | 9066 in_subtree_of_page_scale_layer = host_impl_->active_tree()->LayerById(100); |
9070 node = host_impl_->active_tree()->property_trees()->transform_tree.Node( | 9067 node = host_impl_->active_tree()->property_trees()->transform_tree.Node( |
9071 in_subtree_of_page_scale_layer->transform_tree_index()); | 9068 in_subtree_of_page_scale_layer->transform_tree_index()); |
9072 EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(2.f, 2.f)); | 9069 EXPECT_EQ(node->data.sublayer_scale, gfx::Vector2dF(2.f, 2.f)); |
9073 } | 9070 } |
9074 | 9071 |
9075 } // namespace | 9072 } // namespace |
9076 } // namespace cc | 9073 } // namespace cc |
OLD | NEW |