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