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

Unified Diff: cc/trees/layer_tree_host_unittest_scroll.cc

Issue 14221010: Make LayerTreeImpl::ScrollableArea more robust (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now with a test. Created 7 years, 8 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 | « no previous file | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 76a369b9aa9048ec6934d9105b631acd4e17fd14..80187541c900b9f5f0a1adf5eef35b2c6d47b812 100644
--- a/cc/trees/layer_tree_host_unittest_scroll.cc
+++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -7,6 +7,7 @@
#include "cc/layers/content_layer.h"
#include "cc/layers/layer.h"
#include "cc/layers/layer_impl.h"
+#include "cc/test/fake_content_layer.h"
#include "cc/test/fake_content_layer_client.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/layer_tree_test.h"
@@ -661,5 +662,45 @@ class LayerTreeHostScrollTestScrollZeroMaxScrollOffset
SINGLE_AND_MULTI_THREAD_TEST_F(
LayerTreeHostScrollTestScrollZeroMaxScrollOffset);
+class LayerTreeHostScrollTestScrollUpdateMaxScrollOffset
+ : public LayerTreeHostScrollTest {
+ public:
+ LayerTreeHostScrollTestScrollUpdateMaxScrollOffset() {}
+
+ virtual void BeginTest() OVERRIDE {
+ PostSetNeedsCommitToMainThread();
+ }
+
+ virtual void SetupTree() OVERRIDE {
+ LayerTreeTest::SetupTree();
+ first_content_layer_ = FakeContentLayer::Create(&client_);
+ first_content_layer_->SetBounds(gfx::Size(1, 256));
+ first_content_layer_->set_layer_animation_delegate(this);
+ layer_tree_host()->root_layer()->AddChild(first_content_layer_);
+ second_content_layer_ = FakeContentLayer::Create(&client_);
+ second_content_layer_->SetBounds(gfx::Size(256, 1));
+ second_content_layer_->set_layer_animation_delegate(this);
+ layer_tree_host()->root_layer()->AddChild(second_content_layer_);
+ layer_tree_host()->root_layer()->SetScrollable(true);
+ }
+
+ virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ LayerImpl* root = impl->active_tree()->root_layer();
+ EXPECT_EQ(255, root->max_scroll_offset().x());
+ EXPECT_EQ(255, root->max_scroll_offset().y());
+ EndTest();
+ }
+
+ virtual void AfterTest() OVERRIDE {}
+
+ private:
+ FakeContentLayerClient client_;
+ scoped_refptr<FakeContentLayer> first_content_layer_;
+ scoped_refptr<FakeContentLayer> second_content_layer_;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(
+ LayerTreeHostScrollTestScrollUpdateMaxScrollOffset);
+
} // namespace
} // namespace cc
« no previous file with comments | « no previous file | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698