OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/layers/picture_image_layer_impl.h" | 5 #include "cc/layers/picture_image_layer_impl.h" |
6 | 6 |
7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
8 #include "cc/layers/append_quads_data.h" | 8 #include "cc/layers/append_quads_data.h" |
9 #include "cc/quads/draw_quad.h" | 9 #include "cc/quads/draw_quad.h" |
10 #include "cc/test/fake_display_list_raster_source.h" | 10 #include "cc/test/fake_display_list_raster_source.h" |
11 #include "cc/test/fake_impl_proxy.h" | 11 #include "cc/test/fake_impl_task_runner_provider.h" |
12 #include "cc/test/fake_layer_tree_host_impl.h" | 12 #include "cc/test/fake_layer_tree_host_impl.h" |
13 #include "cc/test/fake_output_surface.h" | 13 #include "cc/test/fake_output_surface.h" |
14 #include "cc/test/test_shared_bitmap_manager.h" | 14 #include "cc/test/test_shared_bitmap_manager.h" |
15 #include "cc/test/test_task_graph_runner.h" | 15 #include "cc/test/test_task_graph_runner.h" |
16 #include "cc/tiles/tile_priority.h" | 16 #include "cc/tiles/tile_priority.h" |
17 #include "cc/trees/layer_tree_impl.h" | 17 #include "cc/trees/layer_tree_impl.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 namespace { | 21 namespace { |
(...skipping 13 matching lines...) Expand all Loading... |
35 class PictureLayerImplImageTestSettings : public LayerTreeSettings { | 35 class PictureLayerImplImageTestSettings : public LayerTreeSettings { |
36 public: | 36 public: |
37 PictureLayerImplImageTestSettings() { | 37 PictureLayerImplImageTestSettings() { |
38 layer_transforms_should_scale_layer_contents = true; | 38 layer_transforms_should_scale_layer_contents = true; |
39 } | 39 } |
40 }; | 40 }; |
41 | 41 |
42 class PictureImageLayerImplTest : public testing::Test { | 42 class PictureImageLayerImplTest : public testing::Test { |
43 public: | 43 public: |
44 PictureImageLayerImplTest() | 44 PictureImageLayerImplTest() |
45 : proxy_(base::ThreadTaskRunnerHandle::Get()), | 45 : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()), |
46 output_surface_(FakeOutputSurface::Create3d()), | 46 output_surface_(FakeOutputSurface::Create3d()), |
47 host_impl_(PictureLayerImplImageTestSettings(), | 47 host_impl_(PictureLayerImplImageTestSettings(), |
48 &proxy_, | 48 &task_runner_provider_, |
49 &shared_bitmap_manager_, | 49 &shared_bitmap_manager_, |
50 &task_graph_runner_) { | 50 &task_graph_runner_) { |
51 host_impl_.CreatePendingTree(); | 51 host_impl_.CreatePendingTree(); |
52 host_impl_.SetVisible(true); | 52 host_impl_.SetVisible(true); |
53 host_impl_.InitializeRenderer(output_surface_.get()); | 53 host_impl_.InitializeRenderer(output_surface_.get()); |
54 } | 54 } |
55 | 55 |
56 scoped_ptr<TestablePictureImageLayerImpl> CreateLayer(int id, | 56 scoped_ptr<TestablePictureImageLayerImpl> CreateLayer(int id, |
57 WhichTree which_tree) { | 57 WhichTree which_tree) { |
58 LayerTreeImpl* tree = nullptr; | 58 LayerTreeImpl* tree = nullptr; |
(...skipping 26 matching lines...) Expand all Loading... |
85 layer->draw_properties().maximum_animation_contents_scale = | 85 layer->draw_properties().maximum_animation_contents_scale = |
86 maximum_animation_contents_scale; | 86 maximum_animation_contents_scale; |
87 layer->draw_properties().screen_space_transform_is_animating = | 87 layer->draw_properties().screen_space_transform_is_animating = |
88 animating_transform_to_screen; | 88 animating_transform_to_screen; |
89 layer->draw_properties().visible_layer_rect = viewport_rect; | 89 layer->draw_properties().visible_layer_rect = viewport_rect; |
90 bool resourceless_software_draw = false; | 90 bool resourceless_software_draw = false; |
91 layer->UpdateTiles(resourceless_software_draw); | 91 layer->UpdateTiles(resourceless_software_draw); |
92 } | 92 } |
93 | 93 |
94 protected: | 94 protected: |
95 FakeImplProxy proxy_; | 95 FakeImplTaskRunnerProvider task_runner_provider_; |
96 TestSharedBitmapManager shared_bitmap_manager_; | 96 TestSharedBitmapManager shared_bitmap_manager_; |
97 TestTaskGraphRunner task_graph_runner_; | 97 TestTaskGraphRunner task_graph_runner_; |
98 scoped_ptr<OutputSurface> output_surface_; | 98 scoped_ptr<OutputSurface> output_surface_; |
99 FakeLayerTreeHostImpl host_impl_; | 99 FakeLayerTreeHostImpl host_impl_; |
100 }; | 100 }; |
101 | 101 |
102 TEST_F(PictureImageLayerImplTest, CalculateContentsScale) { | 102 TEST_F(PictureImageLayerImplTest, CalculateContentsScale) { |
103 scoped_ptr<TestablePictureImageLayerImpl> layer(CreateLayer(1, PENDING_TREE)); | 103 scoped_ptr<TestablePictureImageLayerImpl> layer(CreateLayer(1, PENDING_TREE)); |
104 layer->SetDrawsContent(true); | 104 layer->SetDrawsContent(true); |
105 | 105 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 active_layer->DidDraw(nullptr); | 160 active_layer->DidDraw(nullptr); |
161 | 161 |
162 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material); | 162 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material); |
163 | 163 |
164 // Tiles are ready at correct scale, so should not set had_incomplete_tile. | 164 // Tiles are ready at correct scale, so should not set had_incomplete_tile. |
165 EXPECT_EQ(0, data.num_incomplete_tiles); | 165 EXPECT_EQ(0, data.num_incomplete_tiles); |
166 } | 166 } |
167 | 167 |
168 } // namespace | 168 } // namespace |
169 } // namespace cc | 169 } // namespace cc |
OLD | NEW |