Chromium Code Reviews| Index: cc/trees/layer_tree_host_unittest_scroll.cc |
| diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc |
| index 499f2d63108575fe2aa28cd89231f70ee8e1dcd3..13cb011f7f9d61ea62c03430ce2dc903b66f66f2 100644 |
| --- a/cc/trees/layer_tree_host_unittest_scroll.cc |
| +++ b/cc/trees/layer_tree_host_unittest_scroll.cc |
| @@ -5,11 +5,13 @@ |
| #include "cc/trees/layer_tree_host.h" |
| #include "base/memory/weak_ptr.h" |
| -#include "cc/layers/content_layer.h" |
| #include "cc/layers/layer.h" |
| #include "cc/layers/layer_impl.h" |
| +#include "cc/layers/picture_layer.h" |
| #include "cc/test/fake_content_layer_client.h" |
| #include "cc/test/fake_layer_tree_host_client.h" |
| +#include "cc/test/fake_picture_layer.h" |
| +#include "cc/test/fake_picture_layer_impl.h" |
| #include "cc/test/geometry_test_utils.h" |
| #include "cc/test/layer_tree_test.h" |
| #include "cc/test/test_shared_bitmap_manager.h" |
| @@ -449,7 +451,7 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { |
| scoped_refptr<Layer> root_layer = Layer::Create(); |
| root_layer->SetBounds(gfx::Size(10, 10)); |
| - root_scroll_layer_ = ContentLayer::Create(&fake_content_layer_client_); |
| + root_scroll_layer_ = FakePictureLayer::Create(&fake_content_layer_client_); |
| root_scroll_layer_->SetBounds(gfx::Size(110, 110)); |
| root_scroll_layer_->SetPosition(gfx::Point()); |
| @@ -459,7 +461,7 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { |
| root_scroll_layer_->SetIsContainerForFixedPositionLayers(true); |
| root_layer->AddChild(root_scroll_layer_); |
| - child_layer_ = ContentLayer::Create(&fake_content_layer_client_); |
| + child_layer_ = FakePictureLayer::Create(&fake_content_layer_client_); |
| child_layer_->set_did_scroll_callback( |
| base::Bind(&LayerTreeHostScrollTestCaseWithChild::DidScroll, |
| base::Unretained(this))); |
| @@ -540,8 +542,10 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { |
| virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| LayerImpl* root_impl = impl->active_tree()->root_layer(); |
| - LayerImpl* root_scroll_layer_impl = root_impl->children()[0]; |
| - LayerImpl* child_layer_impl = root_scroll_layer_impl->children()[0]; |
| + FakePictureLayerImpl* root_scroll_layer_impl = |
| + static_cast<FakePictureLayerImpl*>(root_impl->children()[0]); |
| + FakePictureLayerImpl* child_layer_impl = static_cast<FakePictureLayerImpl*>( |
| + root_scroll_layer_impl->children()[0]); |
| LayerImpl* expected_scroll_layer_impl = NULL; |
| LayerImpl* expected_no_scroll_layer_impl = NULL; |
| @@ -557,15 +561,12 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { |
| EXPECT_VECTOR_EQ(gfx::Vector2d(), |
| expected_no_scroll_layer_impl->ScrollDelta()); |
| - // Ensure device scale factor is affecting the layers. |
| - gfx::Size expected_content_bounds = gfx::ToCeiledSize( |
| - gfx::ScaleSize(root_scroll_layer_impl->bounds(), device_scale_factor_)); |
| - EXPECT_SIZE_EQ(expected_content_bounds, |
| - root_scroll_layer_->content_bounds()); |
| + // Ensure device scale factor is affecting the contents scale. |
|
danakj
2014/08/12 13:26:46
I think the comment was fine as is.
sohanjg
2014/08/12 13:38:24
Done.
|
| + EXPECT_FLOAT_EQ(device_scale_factor_, |
| + root_scroll_layer_impl->HighResTiling()->contents_scale()); |
| - expected_content_bounds = gfx::ToCeiledSize( |
| - gfx::ScaleSize(child_layer_impl->bounds(), device_scale_factor_)); |
| - EXPECT_SIZE_EQ(expected_content_bounds, child_layer_->content_bounds()); |
| + EXPECT_FLOAT_EQ(device_scale_factor_, |
| + child_layer_impl->HighResTiling()->contents_scale()); |
| switch (impl->active_tree()->source_frame_number()) { |
| case 0: { |
| @@ -647,7 +648,7 @@ TEST_F(LayerTreeHostScrollTestCaseWithChild, |
| DeviceScaleFactor1_ScrollChild_DirectRenderer_MainThreadPaint) { |
| device_scale_factor_ = 1.f; |
| scroll_child_layer_ = true; |
| - RunTest(true, false, false); |
| + RunTest(true, false, true); |
|
danakj
2014/08/12 13:26:46
This test case is the same as the _ImplSidePaint b
sohanjg
2014/08/12 13:38:23
Done.
|
| } |
| TEST_F(LayerTreeHostScrollTestCaseWithChild, |
| @@ -661,7 +662,7 @@ TEST_F(LayerTreeHostScrollTestCaseWithChild, |
| DeviceScaleFactor1_ScrollChild_DelegatingRenderer_MainThreadPaint) { |
| device_scale_factor_ = 1.f; |
| scroll_child_layer_ = true; |
| - RunTest(true, true, false); |
| + RunTest(true, true, true); |
|
danakj
2014/08/12 13:26:46
same
sohanjg
2014/08/12 13:38:23
Done.
|
| } |
| TEST_F(LayerTreeHostScrollTestCaseWithChild, |
| @@ -731,7 +732,7 @@ TEST_F(LayerTreeHostScrollTestCaseWithChild, |
| DeviceScaleFactor2_ScrollRootScrollLayer_DirectRenderer_MainSidePaint) { |
| device_scale_factor_ = 2.f; |
| scroll_child_layer_ = false; |
| - RunTest(true, false, false); |
| + RunTest(true, false, true); |
|
danakj
2014/08/12 13:26:46
same
sohanjg
2014/08/12 13:38:24
Done.
|
| } |
| TEST_F(LayerTreeHostScrollTestCaseWithChild, |
| @@ -1204,8 +1205,8 @@ class LayerTreeHostScrollTestLayerStructureChange |
| }; |
| Layer* CreateScrollLayer(Layer* parent, FakeLayerScrollClient* client) { |
| - scoped_refptr<Layer> scroll_layer = |
| - ContentLayer::Create(&fake_content_layer_client_); |
| + scoped_refptr<PictureLayer> scroll_layer = |
| + PictureLayer::Create(&fake_content_layer_client_); |
| scroll_layer->SetBounds(gfx::Size(110, 110)); |
| scroll_layer->SetPosition(gfx::Point(0, 0)); |
| scroll_layer->SetIsDrawable(true); |
| @@ -1230,12 +1231,12 @@ class LayerTreeHostScrollTestLayerStructureChange |
| }; |
| TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyLayer) { |
| - RunTest(true, false, false); |
| + RunTest(true, false, true); |
| } |
| TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { |
| scroll_destroy_whole_tree_ = true; |
|
danakj
2014/08/12 13:26:46
This should be a 2space indent.. mind fixing it wh
sohanjg
2014/08/12 13:38:24
Done.
strange why the cl format, didnt take care o
|
| - RunTest(true, false, false); |
| + RunTest(true, false, true); |
| } |
| } // namespace |