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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 25496002: CC: Fix call order of ScrollOffsetDelegate in ActivatePendingTree. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 2ce764d278e6dede7d08c3dbf822f6a49718f884..c958d0a65e4481ce9112b311d01087f1d8f4a376 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -210,16 +210,17 @@ class LayerTreeHostImplTest : public testing::Test,
ASSERT_EQ(0, times_encountered);
}
- LayerImpl* SetupScrollAndContentsLayers(gfx::Size content_size) {
+ LayerImpl* CreateScrollAndContentsLayers(LayerTreeImpl* layer_tree_impl,
+ gfx::Size content_size) {
scoped_ptr<LayerImpl> root =
- LayerImpl::Create(host_impl_->active_tree(), 1);
+ LayerImpl::Create(layer_tree_impl, 1);
root->SetBounds(content_size);
root->SetContentBounds(content_size);
root->SetPosition(gfx::PointF());
root->SetAnchorPoint(gfx::PointF());
scoped_ptr<LayerImpl> scroll =
- LayerImpl::Create(host_impl_->active_tree(), 2);
+ LayerImpl::Create(layer_tree_impl, 2);
LayerImpl* scroll_layer = scroll.get();
scroll->SetScrollable(true);
scroll->SetScrollOffset(gfx::Vector2d());
@@ -231,7 +232,7 @@ class LayerTreeHostImplTest : public testing::Test,
scroll->SetAnchorPoint(gfx::PointF());
scoped_ptr<LayerImpl> contents =
- LayerImpl::Create(host_impl_->active_tree(), 3);
+ LayerImpl::Create(layer_tree_impl, 3);
contents->SetDrawsContent(true);
contents->SetBounds(content_size);
contents->SetContentBounds(content_size);
@@ -241,7 +242,13 @@ class LayerTreeHostImplTest : public testing::Test,
scroll->AddChild(contents.Pass());
root->AddChild(scroll.Pass());
- host_impl_->active_tree()->SetRootLayer(root.Pass());
+ layer_tree_impl->SetRootLayer(root.Pass());
+ return scroll_layer;
+ }
+
+ LayerImpl* SetupScrollAndContentsLayers(gfx::Size content_size) {
+ LayerImpl* scroll_layer = CreateScrollAndContentsLayers(
+ host_impl_->active_tree(), content_size);
host_impl_->active_tree()->DidBecomeActive();
return scroll_layer;
}
@@ -2511,6 +2518,14 @@ TEST_F(LayerTreeHostImplTest, RootLayerScrollOffsetDelegation) {
scroll_delegate.last_set_scroll_offset());
host_impl_->ScrollEnd();
+ // Forces a full tree synchronization and ensures that the scroll delegate
+ // sees the correct size of the new tree.
+ gfx::Size new_size(42, 24);
+ host_impl_->CreatePendingTree();
+ CreateScrollAndContentsLayers(host_impl_->pending_tree(), new_size);
+ host_impl_->ActivatePendingTree();
+ EXPECT_EQ(new_size, scroll_delegate.scrollable_size());
+
// Un-setting the delegate should propagate the delegate's current offset to
// the root scrollable layer.
current_offset = gfx::Vector2dF(13.f, 12.f);
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698