OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "cc/layers/append_quads_data.h" | 7 #include "cc/layers/append_quads_data.h" |
8 #include "cc/layers/nine_patch_layer_impl.h" | 8 #include "cc/layers/nine_patch_layer_impl.h" |
9 #include "cc/quads/texture_draw_quad.h" | 9 #include "cc/quads/texture_draw_quad.h" |
10 #include "cc/resources/ui_resource_bitmap.h" | 10 #include "cc/resources/ui_resource_bitmap.h" |
11 #include "cc/resources/ui_resource_client.h" | 11 #include "cc/resources/ui_resource_client.h" |
| 12 #include "cc/test/fake_compositor_frame_sink.h" |
12 #include "cc/test/fake_impl_task_runner_provider.h" | 13 #include "cc/test/fake_impl_task_runner_provider.h" |
13 #include "cc/test/fake_output_surface.h" | |
14 #include "cc/test/fake_ui_resource_layer_tree_host_impl.h" | 14 #include "cc/test/fake_ui_resource_layer_tree_host_impl.h" |
15 #include "cc/test/geometry_test_utils.h" | 15 #include "cc/test/geometry_test_utils.h" |
16 #include "cc/test/layer_test_common.h" | 16 #include "cc/test/layer_test_common.h" |
17 #include "cc/trees/single_thread_proxy.h" | 17 #include "cc/trees/single_thread_proxy.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "ui/gfx/geometry/rect_conversions.h" | 20 #include "ui/gfx/geometry/rect_conversions.h" |
21 #include "ui/gfx/geometry/safe_integer_conversions.h" | 21 #include "ui/gfx/geometry/safe_integer_conversions.h" |
22 #include "ui/gfx/transform.h" | 22 #include "ui/gfx/transform.h" |
23 | 23 |
(...skipping 15 matching lines...) Expand all Loading... |
39 size_t expected_quad_size) { | 39 size_t expected_quad_size) { |
40 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); | 40 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); |
41 gfx::Rect visible_layer_rect(layer_size); | 41 gfx::Rect visible_layer_rect(layer_size); |
42 gfx::Rect expected_remaining(border.x(), border.y(), | 42 gfx::Rect expected_remaining(border.x(), border.y(), |
43 layer_size.width() - border.width(), | 43 layer_size.width() - border.width(), |
44 layer_size.height() - border.height()); | 44 layer_size.height() - border.height()); |
45 | 45 |
46 FakeImplTaskRunnerProvider task_runner_provider; | 46 FakeImplTaskRunnerProvider task_runner_provider; |
47 TestSharedBitmapManager shared_bitmap_manager; | 47 TestSharedBitmapManager shared_bitmap_manager; |
48 TestTaskGraphRunner task_graph_runner; | 48 TestTaskGraphRunner task_graph_runner; |
49 std::unique_ptr<OutputSurface> output_surface = | 49 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = |
50 FakeOutputSurface::CreateDelegating3d(); | 50 FakeCompositorFrameSink::Create3d(); |
51 FakeUIResourceLayerTreeHostImpl host_impl( | 51 FakeUIResourceLayerTreeHostImpl host_impl( |
52 &task_runner_provider, &shared_bitmap_manager, &task_graph_runner); | 52 &task_runner_provider, &shared_bitmap_manager, &task_graph_runner); |
53 host_impl.SetVisible(true); | 53 host_impl.SetVisible(true); |
54 host_impl.InitializeRenderer(output_surface.get()); | 54 host_impl.InitializeRenderer(compositor_frame_sink.get()); |
55 | 55 |
56 std::unique_ptr<NinePatchLayerImpl> layer = | 56 std::unique_ptr<NinePatchLayerImpl> layer = |
57 NinePatchLayerImpl::Create(host_impl.active_tree(), 1); | 57 NinePatchLayerImpl::Create(host_impl.active_tree(), 1); |
58 layer->draw_properties().visible_layer_rect = visible_layer_rect; | 58 layer->draw_properties().visible_layer_rect = visible_layer_rect; |
59 layer->SetBounds(layer_size); | 59 layer->SetBounds(layer_size); |
60 layer->test_properties()->force_render_surface = true; | 60 layer->test_properties()->force_render_surface = true; |
61 | 61 |
62 UIResourceId uid = 1; | 62 UIResourceId uid = 1; |
63 bool is_opaque = false; | 63 bool is_opaque = false; |
64 UIResourceBitmap bitmap(bitmap_size, is_opaque); | 64 UIResourceBitmap bitmap(bitmap_size, is_opaque); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 image_remaining_right = border_right * ratio_right, | 144 image_remaining_right = border_right * ratio_right, |
145 image_remaining_bottom = border_bottom * ratio_bottom; | 145 image_remaining_bottom = border_bottom * ratio_bottom; |
146 gfx::Rect expected_tex_remaining( | 146 gfx::Rect expected_tex_remaining( |
147 image_remaining_left, image_remaining_top, | 147 image_remaining_left, image_remaining_top, |
148 bitmap_size.width() - image_remaining_right - image_remaining_left, | 148 bitmap_size.width() - image_remaining_right - image_remaining_left, |
149 bitmap_size.height() - image_remaining_bottom - image_remaining_top); | 149 bitmap_size.height() - image_remaining_bottom - image_remaining_top); |
150 | 150 |
151 FakeImplTaskRunnerProvider task_runner_provider; | 151 FakeImplTaskRunnerProvider task_runner_provider; |
152 TestSharedBitmapManager shared_bitmap_manager; | 152 TestSharedBitmapManager shared_bitmap_manager; |
153 TestTaskGraphRunner task_graph_runner; | 153 TestTaskGraphRunner task_graph_runner; |
154 std::unique_ptr<OutputSurface> output_surface = | 154 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = |
155 FakeOutputSurface::CreateDelegating3d(); | 155 FakeCompositorFrameSink::Create3d(); |
156 FakeUIResourceLayerTreeHostImpl host_impl( | 156 FakeUIResourceLayerTreeHostImpl host_impl( |
157 &task_runner_provider, &shared_bitmap_manager, &task_graph_runner); | 157 &task_runner_provider, &shared_bitmap_manager, &task_graph_runner); |
158 host_impl.SetVisible(true); | 158 host_impl.SetVisible(true); |
159 host_impl.InitializeRenderer(output_surface.get()); | 159 host_impl.InitializeRenderer(compositor_frame_sink.get()); |
160 | 160 |
161 std::unique_ptr<NinePatchLayerImpl> layer = | 161 std::unique_ptr<NinePatchLayerImpl> layer = |
162 NinePatchLayerImpl::Create(host_impl.active_tree(), 1); | 162 NinePatchLayerImpl::Create(host_impl.active_tree(), 1); |
163 layer->draw_properties().visible_layer_rect = visible_layer_rect; | 163 layer->draw_properties().visible_layer_rect = visible_layer_rect; |
164 layer->SetBounds(layer_size); | 164 layer->SetBounds(layer_size); |
165 layer->test_properties()->force_render_surface = true; | 165 layer->test_properties()->force_render_surface = true; |
166 | 166 |
167 UIResourceId uid = 1; | 167 UIResourceId uid = 1; |
168 bool is_opaque = false; | 168 bool is_opaque = false; |
169 UIResourceBitmap bitmap(bitmap_size, is_opaque); | 169 UIResourceBitmap bitmap(bitmap_size, is_opaque); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 450 |
451 const QuadList &quad_list = impl.quad_list(); | 451 const QuadList &quad_list = impl.quad_list(); |
452 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); | 452 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); |
453 it != quad_list.BackToFrontEnd(); ++it) | 453 it != quad_list.BackToFrontEnd(); ++it) |
454 EXPECT_TRUE(it->ShouldDrawWithBlending()); | 454 EXPECT_TRUE(it->ShouldDrawWithBlending()); |
455 } | 455 } |
456 } | 456 } |
457 | 457 |
458 } // namespace | 458 } // namespace |
459 } // namespace cc | 459 } // namespace cc |
OLD | NEW |