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

Unified Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 23983047: Pinch/Zoom Infrastructure & Plumbing CL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Backup 2013.10.29 Created 7 years, 2 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
Index: cc/layers/scrollbar_layer_unittest.cc
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc
index 0423cdc06718345328dd23aebea1f00051306bca..532cd4616071717f6139a8a204845bca5c267f5e 100644
--- a/cc/layers/scrollbar_layer_unittest.cc
+++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -45,9 +45,9 @@ LayerImpl* LayerImplForScrollAreaAndScrollbar(
const bool kIsLeftSideVerticalScrollbar = false;
child2 = SolidColorScrollbarLayer::Create(
scrollbar->Orientation(), thumb_thickness,
- kIsLeftSideVerticalScrollbar, child1->id());
+ kIsLeftSideVerticalScrollbar, child1.get());
} else {
- child2 = PaintedScrollbarLayer::Create(scrollbar.Pass(), child1->id());
+ child2 = PaintedScrollbarLayer::Create(scrollbar.Pass(), child1.get());
}
layer_tree_root->AddChild(child1);
layer_tree_root->InsertChild(child2, reverse_order ? 0 : 1);
@@ -66,7 +66,8 @@ TEST(ScrollbarLayerTest, ResolveScrollLayerPointer) {
static_cast<PaintedScrollbarLayerImpl*>(
layer_impl_tree_root->children()[1]);
- EXPECT_EQ(cc_child1->horizontal_scrollbar_layer(), cc_child2);
+ EXPECT_EQ(cc_child1->scrollbars()->size(), 1UL);
+ EXPECT_EQ(*(cc_child1->scrollbars()->begin()), cc_child2);
}
TEST(ScrollbarLayerTest, ResolveScrollLayerPointer_ReverseOrder) {
@@ -80,7 +81,8 @@ TEST(ScrollbarLayerTest, ResolveScrollLayerPointer_ReverseOrder) {
layer_impl_tree_root->children()[0]);
LayerImpl* cc_child2 = layer_impl_tree_root->children()[1];
- EXPECT_EQ(cc_child2->horizontal_scrollbar_layer(), cc_child1);
+ EXPECT_EQ(cc_child2->scrollbars()->size(), 1UL);
+ EXPECT_EQ(*(cc_child2->scrollbars()->begin()), cc_child1);
}
TEST(ScrollbarLayerTest, ShouldScrollNonOverlayOnMainThread) {
@@ -123,11 +125,11 @@ TEST(PaintedScrollbarLayerTest, ScrollOffsetSynchronization) {
scoped_refptr<Layer> layer_tree_root = Layer::Create();
scoped_refptr<Layer> content_layer = Layer::Create();
scoped_refptr<Layer> scrollbar_layer =
- PaintedScrollbarLayer::Create(scrollbar.Pass(), layer_tree_root->id());
+ PaintedScrollbarLayer::Create(scrollbar.Pass(), layer_tree_root.get());
- layer_tree_root->SetScrollable(true);
+ layer_tree_root->SetScrollable(layer_tree_root.get()); // WJM
layer_tree_root->SetScrollOffset(gfx::Vector2d(10, 20));
- layer_tree_root->SetMaxScrollOffset(gfx::Vector2d(30, 50));
+// layer_tree_root->SetMaxScrollOffset(gfx::Vector2d(30, 50)); // WJM
layer_tree_root->SetBounds(gfx::Size(100, 200));
content_layer->SetBounds(gfx::Size(100, 200));
@@ -148,7 +150,7 @@ TEST(PaintedScrollbarLayerTest, ScrollOffsetSynchronization) {
EXPECT_EQ(30, cc_scrollbar_layer->maximum());
layer_tree_root->SetScrollOffset(gfx::Vector2d(100, 200));
- layer_tree_root->SetMaxScrollOffset(gfx::Vector2d(300, 500));
+// layer_tree_root->SetMaxScrollOffset(gfx::Vector2d(300, 500)); // WJM
layer_tree_root->SetBounds(gfx::Size(1000, 2000));
layer_tree_root->SavePaintProperties();
content_layer->SetBounds(gfx::Size(1000, 2000));
@@ -174,10 +176,10 @@ TEST(ScrollbarLayerTest, ThumbRect) {
scoped_refptr<Layer> root_layer = Layer::Create();
scoped_refptr<Layer> content_layer = Layer::Create();
scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer =
- FakePaintedScrollbarLayer::Create(false, true, root_layer->id());
+ FakePaintedScrollbarLayer::Create(false, true, root_layer.get());
- root_layer->SetScrollable(true);
- root_layer->SetMaxScrollOffset(gfx::Vector2d(80, 0));
+ root_layer->SetScrollable(root_layer.get()); // WJM
+// root_layer->SetMaxScrollOffset(gfx::Vector2d(80, 0));
root_layer->SetBounds(gfx::Size(100, 50));
content_layer->SetBounds(gfx::Size(100, 50));
@@ -342,9 +344,9 @@ TEST(ScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) {
scrollbar_layer_impl->SetCurrentPos(4.f);
scrollbar_layer_impl->SetMaximum(8);
- layer_impl_tree_root->SetScrollable(true);
- layer_impl_tree_root->SetHorizontalScrollbarLayer(scrollbar_layer_impl);
- layer_impl_tree_root->SetMaxScrollOffset(gfx::Vector2d(8, 8));
+ layer_impl_tree_root->SetScrollable(42); // WJM
+ layer_impl_tree_root->AddScrollbar(scrollbar_layer_impl);
+// layer_impl_tree_root->SetMaxScrollOffset(gfx::Vector2d(8, 8)); // WJM
layer_impl_tree_root->SetBounds(gfx::Size(2, 2));
layer_impl_tree_root->ScrollBy(gfx::Vector2dF(4.f, 0.f));
@@ -456,16 +458,17 @@ class ScrollbarLayerTestMaxTextureSize : public LayerTreeTest {
void SetScrollbarBounds(gfx::Size bounds) { bounds_ = bounds; }
virtual void BeginTest() OVERRIDE {
+ scroll_layer_ = Layer::Create();
+ layer_tree_host()->root_layer()->AddChild(scroll_layer_);
+
scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar);
- scrollbar_layer_ = PaintedScrollbarLayer::Create(scrollbar.Pass(), 1);
+ scrollbar_layer_ =
+ PaintedScrollbarLayer::Create(scrollbar.Pass(), scroll_layer_.get());
+ scrollbar_layer_->SetScrollLayer(scroll_layer_);
scrollbar_layer_->SetLayerTreeHost(layer_tree_host());
scrollbar_layer_->SetBounds(bounds_);
layer_tree_host()->root_layer()->AddChild(scrollbar_layer_);
- scroll_layer_ = Layer::Create();
- scrollbar_layer_->SetScrollLayerId(scroll_layer_->id());
- layer_tree_host()->root_layer()->AddChild(scroll_layer_);
-
PostSetNeedsCommitToMainThread();
}
@@ -584,10 +587,10 @@ class ScrollbarLayerTestResourceCreation : public testing::Test {
SolidColorScrollbarLayer::Create(scrollbar->Orientation(),
kThumbThickness,
kIsLeftSideVerticalScrollbar,
- layer_tree_root->id());
+ layer_tree_root.get());
} else {
scrollbar_layer = PaintedScrollbarLayer::Create(scrollbar.Pass(),
- layer_tree_root->id());
+ layer_tree_root.get());
}
layer_tree_root->AddChild(content_layer);
layer_tree_root->AddChild(scrollbar_layer);
@@ -598,7 +601,7 @@ class ScrollbarLayerTestResourceCreation : public testing::Test {
scrollbar_layer->SetIsDrawable(true);
scrollbar_layer->SetBounds(gfx::Size(100, 100));
layer_tree_root->SetScrollOffset(gfx::Vector2d(10, 20));
- layer_tree_root->SetMaxScrollOffset(gfx::Vector2d(30, 50));
+// layer_tree_root->SetMaxScrollOffset(gfx::Vector2d(30, 50)); // WJM
layer_tree_root->SetBounds(gfx::Size(100, 200));
content_layer->SetBounds(gfx::Size(100, 200));
scrollbar_layer->draw_properties().content_bounds = gfx::Size(100, 200);
@@ -665,7 +668,7 @@ class ScaledScrollbarLayerTestResourceCreation : public testing::Test {
scoped_refptr<Layer> layer_tree_root = Layer::Create();
scoped_refptr<Layer> content_layer = Layer::Create();
scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer =
- FakePaintedScrollbarLayer::Create(false, true, layer_tree_root->id());
+ FakePaintedScrollbarLayer::Create(false, true, layer_tree_root.get());
layer_tree_root->AddChild(content_layer);
layer_tree_root->AddChild(scrollbar_layer);

Powered by Google App Engine
This is Rietveld 408576698