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

Unified Diff: cc/layers/picture_image_layer_impl_unittest.cc

Issue 1544103002: Determine a layer's IsAffectedByPageScale property without using Layer Tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: cc/layers/picture_image_layer_impl_unittest.cc
diff --git a/cc/layers/picture_image_layer_impl_unittest.cc b/cc/layers/picture_image_layer_impl_unittest.cc
index 92e6926852aec2b17a72d6a4d8411b5bd1a34d77..53b0061b05ca85f4aafd45a2d3fceda8c72db687 100644
--- a/cc/layers/picture_image_layer_impl_unittest.cc
+++ b/cc/layers/picture_image_layer_impl_unittest.cc
@@ -108,10 +108,14 @@ TEST_F(PictureImageLayerImplTest, CalculateContentsScale) {
scoped_ptr<TestablePictureImageLayerImpl> layer(CreateLayer(1, PENDING_TREE));
layer->SetDrawsContent(true);
+ TestablePictureImageLayerImpl* layer_ptr = layer.get();
+ host_impl_.pending_tree()->SetRootLayer(std::move(layer));
+ host_impl_.pending_tree()->BuildPropertyTreesForTesting();
+
gfx::Rect viewport(100, 200);
- SetupDrawPropertiesAndUpdateTiles(
- layer.get(), 2.f, 3.f, 4.f, 1.f, false, viewport);
- EXPECT_FLOAT_EQ(1.f, layer->MaximumTilingContentsScale());
+ SetupDrawPropertiesAndUpdateTiles(layer_ptr, 2.f, 3.f, 4.f, 1.f, false,
+ viewport);
+ EXPECT_FLOAT_EQ(1.f, layer_ptr->MaximumTilingContentsScale());
}
TEST_F(PictureImageLayerImplTest, IgnoreIdealContentScale) {
@@ -121,6 +125,10 @@ TEST_F(PictureImageLayerImplTest, IgnoreIdealContentScale) {
gfx::Rect viewport(100, 200);
+ TestablePictureImageLayerImpl* pending_layer_ptr = pending_layer.get();
+ host_impl_.pending_tree()->SetRootLayer(std::move(pending_layer));
+ host_impl_.pending_tree()->BuildPropertyTreesForTesting();
+
// Set PictureLayerImpl::ideal_contents_scale_ to 2.f which is not equal
// to the content scale used by PictureImageLayerImpl.
const float suggested_ideal_contents_scale = 2.f;
@@ -128,17 +136,13 @@ TEST_F(PictureImageLayerImplTest, IgnoreIdealContentScale) {
const float page_scale_factor = 4.f;
const float maximum_animation_contents_scale = 1.f;
const bool animating_transform_to_screen = false;
- SetupDrawPropertiesAndUpdateTiles(pending_layer.get(),
- suggested_ideal_contents_scale,
- device_scale_factor,
- page_scale_factor,
- maximum_animation_contents_scale,
- animating_transform_to_screen,
- viewport);
- EXPECT_EQ(1.f, pending_layer->tilings()->tiling_at(0)->contents_scale());
+ SetupDrawPropertiesAndUpdateTiles(
+ pending_layer_ptr, suggested_ideal_contents_scale, device_scale_factor,
+ page_scale_factor, maximum_animation_contents_scale,
+ animating_transform_to_screen, viewport);
+ EXPECT_EQ(1.f, pending_layer_ptr->tilings()->tiling_at(0)->contents_scale());
// Push to active layer.
- host_impl_.pending_tree()->SetRootLayer(std::move(pending_layer));
host_impl_.ActivateSyncTree();
TestablePictureImageLayerImpl* active_layer =

Powered by Google App Engine
This is Rietveld 408576698