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

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 271533011: cc: Move tiling management out of draw properties calculation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unit tests + review comments Created 6 years, 7 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
OLDNEW
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/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "cc/animation/layer_animation_controller.h" 9 #include "cc/animation/layer_animation_controller.h"
10 #include "cc/animation/transform_operations.h" 10 #include "cc/animation/transform_operations.h"
(...skipping 8293 matching lines...) Expand 10 before | Expand all | Expand 10 after
8304 expected.insert(grand_parent_raw); 8304 expected.insert(grand_parent_raw);
8305 expected.insert(parent_raw); 8305 expected.insert(parent_raw);
8306 expected.insert(child_raw); 8306 expected.insert(child_raw);
8307 expected.insert(grand_child1_raw); 8307 expected.insert(grand_child1_raw);
8308 expected.insert(grand_child2_raw); 8308 expected.insert(grand_child2_raw);
8309 8309
8310 actual.clear(); 8310 actual.clear();
8311 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); 8311 GatherDrawnLayers(render_surface_layer_list_impl(), &actual);
8312 EXPECT_EQ(expected, actual); 8312 EXPECT_EQ(expected, actual);
8313 } 8313 }
8314
8315 TEST_F(LayerTreeHostCommonTest, VerifyLayerDrawProperties) {
danakj 2014/05/23 17:07:34 how about name this "DrawPropertyScales" The "Ver
8316 FakeImplProxy proxy;
8317 TestSharedBitmapManager shared_bitmap_manager;
8318 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
8319
8320 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1);
8321 LayerImpl* root_layer = root.get();
8322 scoped_ptr<LayerImpl> child1 = LayerImpl::Create(host_impl.active_tree(), 2);
8323 LayerImpl* child1_layer = child1.get();
8324 scoped_ptr<LayerImpl> child2 = LayerImpl::Create(host_impl.active_tree(), 3);
8325 LayerImpl* child2_layer = child2.get();
8326
8327 root->AddChild(child1.Pass());
8328 root->AddChild(child2.Pass());
8329
8330 gfx::Transform identity_matrix, scale_transform_child1,
8331 scale_transform_child2;
8332 scale_transform_child1.Scale(2, 3);
8333 scale_transform_child2.Scale(4, 5);
8334
8335 SetLayerPropertiesForTesting(root_layer,
8336 identity_matrix,
8337 gfx::PointF(),
8338 gfx::PointF(),
8339 gfx::Size(),
8340 true,
8341 false);
8342 SetLayerPropertiesForTesting(child1_layer,
8343 scale_transform_child1,
8344 gfx::PointF(),
8345 gfx::PointF(),
8346 gfx::Size(),
8347 true,
8348 false);
8349
8350 TransformOperations scale;
8351 scale.AppendScale(5.f, 8.f, 3.f);
8352
8353 AddAnimatedTransformToLayer(child2_layer, 1.0, TransformOperations(), scale);
8354 SetLayerPropertiesForTesting(child2_layer,
8355 scale_transform_child2,
8356 gfx::PointF(),
8357 gfx::PointF(),
8358 gfx::Size(),
8359 true,
8360 false);
8361
8362 ExecuteCalculateDrawProperties(root_layer);
8363
8364 EXPECT_FLOAT_EQ(1.f, root_layer->draw_properties().ideal_contents_scale);
8365 EXPECT_FLOAT_EQ(3.f, child1_layer->draw_properties().ideal_contents_scale);
8366 EXPECT_FLOAT_EQ(5.f, child2_layer->draw_properties().ideal_contents_scale);
8367
8368 EXPECT_FLOAT_EQ(
8369 0.f, root_layer->draw_properties().maximum_animation_contents_scale);
8370 EXPECT_FLOAT_EQ(
8371 0.f, child1_layer->draw_properties().maximum_animation_contents_scale);
8372 EXPECT_FLOAT_EQ(
8373 8.f, child2_layer->draw_properties().maximum_animation_contents_scale);
8374
8375 EXPECT_FLOAT_EQ(1.f, root_layer->draw_properties().page_scale_factor);
danakj 2014/05/23 17:07:34 Can you set a page scale factor on the host_impl.a
8376 EXPECT_FLOAT_EQ(1.f, child1_layer->draw_properties().page_scale_factor);
8377 EXPECT_FLOAT_EQ(1.f, child2_layer->draw_properties().page_scale_factor);
8378
8379 EXPECT_FLOAT_EQ(1.f, root_layer->draw_properties().device_scale_factor);
8380 EXPECT_FLOAT_EQ(1.f, child1_layer->draw_properties().device_scale_factor);
8381 EXPECT_FLOAT_EQ(1.f, child2_layer->draw_properties().device_scale_factor);
8382 }
8383
8314 } // namespace 8384 } // namespace
8315 } // namespace cc 8385 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698