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 "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 // Allow commits to happen once BeginTest() has had a chance to post tasks | 688 // Allow commits to happen once BeginTest() has had a chance to post tasks |
689 // so that those tasks will happen before the first commit. | 689 // so that those tasks will happen before the first commit. |
690 if (layer_tree_host_) { | 690 if (layer_tree_host_) { |
691 static_cast<LayerTreeHostForTesting*>(layer_tree_host_.get()) | 691 static_cast<LayerTreeHostForTesting*>(layer_tree_host_.get()) |
692 ->set_test_started(true); | 692 ->set_test_started(true); |
693 } | 693 } |
694 } | 694 } |
695 | 695 |
696 void LayerTreeTest::SetupTree() { | 696 void LayerTreeTest::SetupTree() { |
697 if (!layer_tree_host_->root_layer()) { | 697 if (!layer_tree_host_->root_layer()) { |
698 scoped_refptr<Layer> root_layer = Layer::Create(); | 698 scoped_refptr<Layer> root_layer = Layer::Create(layer_settings_); |
699 root_layer->SetBounds(gfx::Size(1, 1)); | 699 root_layer->SetBounds(gfx::Size(1, 1)); |
700 root_layer->SetIsDrawable(true); | 700 root_layer->SetIsDrawable(true); |
701 layer_tree_host_->SetRootLayer(root_layer); | 701 layer_tree_host_->SetRootLayer(root_layer); |
702 } | 702 } |
703 | 703 |
704 gfx::Size root_bounds = layer_tree_host_->root_layer()->bounds(); | 704 gfx::Size root_bounds = layer_tree_host_->root_layer()->bounds(); |
705 gfx::Size device_root_bounds = gfx::ToCeiledSize( | 705 gfx::Size device_root_bounds = gfx::ToCeiledSize( |
706 gfx::ScaleSize(root_bounds, layer_tree_host_->device_scale_factor())); | 706 gfx::ScaleSize(root_bounds, layer_tree_host_->device_scale_factor())); |
707 layer_tree_host_->SetViewportSize(device_root_bounds); | 707 layer_tree_host_->SetViewportSize(device_root_bounds); |
708 } | 708 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 | 805 |
806 delegating_renderer_ = delegating_renderer; | 806 delegating_renderer_ = delegating_renderer; |
807 | 807 |
808 // Spend less time waiting for BeginFrame because the output is | 808 // Spend less time waiting for BeginFrame because the output is |
809 // mocked out. | 809 // mocked out. |
810 settings_.renderer_settings.refresh_rate = 200.0; | 810 settings_.renderer_settings.refresh_rate = 200.0; |
811 settings_.background_animation_rate = 200.0; | 811 settings_.background_animation_rate = 200.0; |
812 settings_.impl_side_painting = impl_side_painting; | 812 settings_.impl_side_painting = impl_side_painting; |
813 settings_.verify_property_trees = verify_property_trees_; | 813 settings_.verify_property_trees = verify_property_trees_; |
814 InitializeSettings(&settings_); | 814 InitializeSettings(&settings_); |
| 815 InitializeLayerSettings(&layer_settings_); |
815 | 816 |
816 main_task_runner_->PostTask( | 817 main_task_runner_->PostTask( |
817 FROM_HERE, | 818 FROM_HERE, |
818 base::Bind(&LayerTreeTest::DoBeginTest, base::Unretained(this))); | 819 base::Bind(&LayerTreeTest::DoBeginTest, base::Unretained(this))); |
819 | 820 |
820 if (timeout_seconds_) { | 821 if (timeout_seconds_) { |
821 timeout_.Reset(base::Bind(&LayerTreeTest::Timeout, base::Unretained(this))); | 822 timeout_.Reset(base::Bind(&LayerTreeTest::Timeout, base::Unretained(this))); |
822 main_task_runner_->PostDelayedTask( | 823 main_task_runner_->PostDelayedTask( |
823 FROM_HERE, | 824 FROM_HERE, |
824 timeout_.callback(), | 825 timeout_.callback(), |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 LayerTreeHost* LayerTreeTest::layer_tree_host() { | 892 LayerTreeHost* LayerTreeTest::layer_tree_host() { |
892 // We check for a null proxy here as we sometimes ask for the layer tree host | 893 // We check for a null proxy here as we sometimes ask for the layer tree host |
893 // when the proxy does not exist, often for checking settings after a test has | 894 // when the proxy does not exist, often for checking settings after a test has |
894 // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See | 895 // completed. For example, LTHPixelResourceTest::RunPixelResourceTest. See |
895 // elsewhere in this file for other examples. | 896 // elsewhere in this file for other examples. |
896 DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked()); | 897 DCHECK(!proxy() || proxy()->IsMainThread() || proxy()->IsMainThreadBlocked()); |
897 return layer_tree_host_.get(); | 898 return layer_tree_host_.get(); |
898 } | 899 } |
899 | 900 |
900 } // namespace cc | 901 } // namespace cc |
OLD | NEW |