| 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/test/layer_tree_test.h" | 5 #include "cc/test/layer_tree_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "cc/animation/animation.h" | 8 #include "cc/animation/animation.h" |
| 9 #include "cc/animation/animation_registrar.h" | 9 #include "cc/animation/animation_registrar.h" |
| 10 #include "cc/animation/layer_animation_controller.h" | 10 #include "cc/animation/layer_animation_controller.h" |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 373 } |
| 374 | 374 |
| 375 void RequestNewOutputSurface(bool fallback) override { | 375 void RequestNewOutputSurface(bool fallback) override { |
| 376 test_hooks_->RequestNewOutputSurface(fallback); | 376 test_hooks_->RequestNewOutputSurface(fallback); |
| 377 } | 377 } |
| 378 | 378 |
| 379 void DidInitializeOutputSurface() override { | 379 void DidInitializeOutputSurface() override { |
| 380 test_hooks_->DidInitializeOutputSurface(); | 380 test_hooks_->DidInitializeOutputSurface(); |
| 381 } | 381 } |
| 382 | 382 |
| 383 void SendBeginFramesToChildren(const BeginFrameArgs& args) override { |
| 384 test_hooks_->SendBeginFramesToChildren(args); |
| 385 } |
| 386 |
| 383 void DidFailToInitializeOutputSurface() override { | 387 void DidFailToInitializeOutputSurface() override { |
| 384 test_hooks_->DidFailToInitializeOutputSurface(); | 388 test_hooks_->DidFailToInitializeOutputSurface(); |
| 385 } | 389 } |
| 386 | 390 |
| 387 void WillCommit() override { test_hooks_->WillCommit(); } | 391 void WillCommit() override { test_hooks_->WillCommit(); } |
| 388 | 392 |
| 389 void DidCommit() override { test_hooks_->DidCommit(); } | 393 void DidCommit() override { test_hooks_->DidCommit(); } |
| 390 | 394 |
| 391 void DidCommitAndDrawFrame() override { | 395 void DidCommitAndDrawFrame() override { |
| 392 test_hooks_->DidCommitAndDrawFrame(); | 396 test_hooks_->DidCommitAndDrawFrame(); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 void LayerTreeTest::WillBeginTest() { | 604 void LayerTreeTest::WillBeginTest() { |
| 601 layer_tree_host_->SetLayerTreeHostClientReady(); | 605 layer_tree_host_->SetLayerTreeHostClientReady(); |
| 602 } | 606 } |
| 603 | 607 |
| 604 void LayerTreeTest::DoBeginTest() { | 608 void LayerTreeTest::DoBeginTest() { |
| 605 client_ = LayerTreeHostClientForTesting::Create(this); | 609 client_ = LayerTreeHostClientForTesting::Create(this); |
| 606 | 610 |
| 607 scoped_ptr<ExternalBeginFrameSourceForTest> external_begin_frame_source; | 611 scoped_ptr<ExternalBeginFrameSourceForTest> external_begin_frame_source; |
| 608 if (settings_.use_external_begin_frame_source && | 612 if (settings_.use_external_begin_frame_source && |
| 609 settings_.throttle_frame_production) { | 613 settings_.throttle_frame_production) { |
| 610 external_begin_frame_source.reset( | 614 external_begin_frame_source.reset(new ExternalBeginFrameSourceForTest( |
| 611 new ExternalBeginFrameSourceForTest(settings_.refresh_rate)); | 615 settings_.renderer_settings.refresh_rate)); |
| 612 external_begin_frame_source_ = external_begin_frame_source.get(); | 616 external_begin_frame_source_ = external_begin_frame_source.get(); |
| 613 } | 617 } |
| 614 | 618 |
| 615 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); | 619 DCHECK(!impl_thread_ || impl_thread_->message_loop_proxy().get()); |
| 616 layer_tree_host_ = LayerTreeHostForTesting::Create( | 620 layer_tree_host_ = LayerTreeHostForTesting::Create( |
| 617 this, | 621 this, |
| 618 client_.get(), | 622 client_.get(), |
| 619 settings_, | 623 settings_, |
| 620 base::MessageLoopProxy::current(), | 624 base::MessageLoopProxy::current(), |
| 621 impl_thread_ ? impl_thread_->message_loop_proxy() : NULL, | 625 impl_thread_ ? impl_thread_->message_loop_proxy() : NULL, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 impl_thread_.reset(new base::Thread("Compositor")); | 738 impl_thread_.reset(new base::Thread("Compositor")); |
| 735 ASSERT_TRUE(impl_thread_->Start()); | 739 ASSERT_TRUE(impl_thread_->Start()); |
| 736 } | 740 } |
| 737 | 741 |
| 738 main_task_runner_ = base::MessageLoopProxy::current(); | 742 main_task_runner_ = base::MessageLoopProxy::current(); |
| 739 | 743 |
| 740 delegating_renderer_ = delegating_renderer; | 744 delegating_renderer_ = delegating_renderer; |
| 741 | 745 |
| 742 // Spend less time waiting for BeginFrame because the output is | 746 // Spend less time waiting for BeginFrame because the output is |
| 743 // mocked out. | 747 // mocked out. |
| 744 settings_.refresh_rate = 200.0; | 748 settings_.renderer_settings.refresh_rate = 200.0; |
| 745 settings_.background_animation_rate = 200.0; | 749 settings_.background_animation_rate = 200.0; |
| 746 settings_.impl_side_painting = impl_side_painting; | 750 settings_.impl_side_painting = impl_side_painting; |
| 747 InitializeSettings(&settings_); | 751 InitializeSettings(&settings_); |
| 748 | 752 |
| 749 main_task_runner_->PostTask( | 753 main_task_runner_->PostTask( |
| 750 FROM_HERE, | 754 FROM_HERE, |
| 751 base::Bind(&LayerTreeTest::DoBeginTest, base::Unretained(this))); | 755 base::Bind(&LayerTreeTest::DoBeginTest, base::Unretained(this))); |
| 752 | 756 |
| 753 if (timeout_seconds_) { | 757 if (timeout_seconds_) { |
| 754 timeout_.Reset(base::Bind(&LayerTreeTest::Timeout, base::Unretained(this))); | 758 timeout_.Reset(base::Bind(&LayerTreeTest::Timeout, base::Unretained(this))); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 return -1; | 824 return -1; |
| 821 } | 825 } |
| 822 | 826 |
| 823 void LayerTreeTest::DestroyLayerTreeHost() { | 827 void LayerTreeTest::DestroyLayerTreeHost() { |
| 824 if (layer_tree_host_ && layer_tree_host_->root_layer()) | 828 if (layer_tree_host_ && layer_tree_host_->root_layer()) |
| 825 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); | 829 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); |
| 826 layer_tree_host_ = nullptr; | 830 layer_tree_host_ = nullptr; |
| 827 } | 831 } |
| 828 | 832 |
| 829 } // namespace cc | 833 } // namespace cc |
| OLD | NEW |