Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: cc/test/layer_test_common.cc

Issue 1783613004: CC Animation: Erase cc::LayerSettings everywhere. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@eraseandroid
Patch Set: Rebase. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/fake_picture_layer.cc ('k') | cc/test/layer_tree_host_common_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/test/layer_test_common.h" 5 #include "cc/test/layer_test_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "cc/animation/animation_host.h" 9 #include "cc/animation/animation_host.h"
10 #include "cc/animation/animation_id_provider.h" 10 #include "cc/animation/animation_id_provider.h"
11 #include "cc/animation/animation_player.h" 11 #include "cc/animation/animation_player.h"
12 #include "cc/base/math_util.h" 12 #include "cc/base/math_util.h"
13 #include "cc/base/region.h" 13 #include "cc/base/region.h"
14 #include "cc/layers/append_quads_data.h" 14 #include "cc/layers/append_quads_data.h"
15 #include "cc/output/copy_output_request.h" 15 #include "cc/output/copy_output_request.h"
16 #include "cc/output/copy_output_result.h" 16 #include "cc/output/copy_output_result.h"
17 #include "cc/quads/draw_quad.h" 17 #include "cc/quads/draw_quad.h"
18 #include "cc/quads/render_pass.h" 18 #include "cc/quads/render_pass.h"
19 #include "cc/test/animation_test_common.h" 19 #include "cc/test/animation_test_common.h"
20 #include "cc/test/fake_output_surface.h" 20 #include "cc/test/fake_output_surface.h"
21 #include "cc/test/layer_tree_settings_for_testing.h"
22 #include "cc/test/mock_occlusion_tracker.h" 21 #include "cc/test/mock_occlusion_tracker.h"
23 #include "cc/trees/layer_tree_host_common.h" 22 #include "cc/trees/layer_tree_host_common.h"
24 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
25 #include "ui/gfx/geometry/point_conversions.h" 24 #include "ui/gfx/geometry/point_conversions.h"
26 #include "ui/gfx/geometry/rect.h" 25 #include "ui/gfx/geometry/rect.h"
27 #include "ui/gfx/geometry/rect_conversions.h" 26 #include "ui/gfx/geometry/rect_conversions.h"
28 #include "ui/gfx/geometry/size_conversions.h" 27 #include "ui/gfx/geometry/size_conversions.h"
29 28
30 namespace cc { 29 namespace cc {
31 30
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 EXPECT_EQ(quad->rect.ToString(), quad->visible_rect.ToString()); 110 EXPECT_EQ(quad->rect.ToString(), quad->visible_rect.ToString());
112 } else { 111 } else {
113 EXPECT_NE(quad->rect.ToString(), quad->visible_rect.ToString()); 112 EXPECT_NE(quad->rect.ToString(), quad->visible_rect.ToString());
114 EXPECT_TRUE(quad->rect.Contains(quad->visible_rect)); 113 EXPECT_TRUE(quad->rect.Contains(quad->visible_rect));
115 ++(*partially_occluded_count); 114 ++(*partially_occluded_count);
116 } 115 }
117 } 116 }
118 } 117 }
119 118
120 LayerTestCommon::LayerImplTest::LayerImplTest() 119 LayerTestCommon::LayerImplTest::LayerImplTest()
121 : LayerImplTest(LayerTreeSettingsForTesting()) {} 120 : LayerImplTest(LayerTreeSettings()) {}
122 121
123 LayerTestCommon::LayerImplTest::LayerImplTest(const LayerTreeSettings& settings) 122 LayerTestCommon::LayerImplTest::LayerImplTest(const LayerTreeSettings& settings)
124 : client_(FakeLayerTreeHostClient::DIRECT_3D), 123 : client_(FakeLayerTreeHostClient::DIRECT_3D),
125 output_surface_(FakeOutputSurface::Create3d()), 124 output_surface_(FakeOutputSurface::Create3d()),
126 host_(FakeLayerTreeHost::Create(&client_, &task_graph_runner_, settings)), 125 host_(FakeLayerTreeHost::Create(&client_, &task_graph_runner_, settings)),
127 root_layer_impl_(LayerImpl::Create(host_->host_impl()->active_tree(), 1)), 126 root_layer_impl_(LayerImpl::Create(host_->host_impl()->active_tree(), 1)),
128 render_pass_(RenderPass::Create()), 127 render_pass_(RenderPass::Create()),
129 layer_impl_id_(2) { 128 layer_impl_id_(2) {
130 root_layer_impl_->SetHasRenderSurface(true); 129 root_layer_impl_->SetHasRenderSurface(true);
131 host_->host_impl()->SetVisible(true); 130 host_->host_impl()->SetVisible(true);
132 host_->host_impl()->InitializeRenderer(output_surface_.get()); 131 host_->host_impl()->InitializeRenderer(output_surface_.get());
133 132
134 if (host_->settings().use_compositor_animation_timelines) { 133 const int timeline_id = AnimationIdProvider::NextTimelineId();
135 const int timeline_id = AnimationIdProvider::NextTimelineId(); 134 timeline_ = AnimationTimeline::Create(timeline_id);
136 timeline_ = AnimationTimeline::Create(timeline_id); 135 host_->animation_host()->AddAnimationTimeline(timeline_);
137 host_->animation_host()->AddAnimationTimeline(timeline_); 136 // Create impl-side instance.
138 // Create impl-side instance. 137 host_->animation_host()->PushPropertiesTo(
139 host_->animation_host()->PushPropertiesTo( 138 host_->host_impl()->animation_host());
140 host_->host_impl()->animation_host()); 139 timeline_impl_ =
141 timeline_impl_ = 140 host_->host_impl()->animation_host()->GetTimelineById(timeline_id);
142 host_->host_impl()->animation_host()->GetTimelineById(timeline_id);
143 }
144 } 141 }
145 142
146 LayerTestCommon::LayerImplTest::~LayerImplTest() { 143 LayerTestCommon::LayerImplTest::~LayerImplTest() {
147 if (host_->settings().use_compositor_animation_timelines) { 144 host_->animation_host()->RemoveAnimationTimeline(timeline_);
148 host_->animation_host()->RemoveAnimationTimeline(timeline_); 145 timeline_ = nullptr;
149 timeline_ = nullptr;
150 }
151 } 146 }
152 147
153 void LayerTestCommon::LayerImplTest::CalcDrawProps( 148 void LayerTestCommon::LayerImplTest::CalcDrawProps(
154 const gfx::Size& viewport_size) { 149 const gfx::Size& viewport_size) {
155 LayerImplList layer_list; 150 LayerImplList layer_list;
156 host_->host_impl()->active_tree()->IncrementRenderSurfaceListIdForTesting(); 151 host_->host_impl()->active_tree()->IncrementRenderSurfaceListIdForTesting();
157 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 152 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
158 root_layer_impl_.get(), viewport_size, &layer_list, 153 root_layer_impl_.get(), viewport_size, &layer_list,
159 host_->host_impl()->active_tree()->current_render_surface_list_id()); 154 host_->host_impl()->active_tree()->current_render_surface_list_id());
160 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 155 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} 208 void EmptyCopyOutputCallback(scoped_ptr<CopyOutputResult> result) {}
214 209
215 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() { 210 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() {
216 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests; 211 std::vector<scoped_ptr<CopyOutputRequest>> copy_requests;
217 copy_requests.push_back( 212 copy_requests.push_back(
218 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); 213 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
219 root_layer_impl_->PassCopyRequests(&copy_requests); 214 root_layer_impl_->PassCopyRequests(&copy_requests);
220 } 215 }
221 216
222 } // namespace cc 217 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_picture_layer.cc ('k') | cc/test/layer_tree_host_common_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698