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

Side by Side Diff: cc/scrollbar_layer_unittest.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Apply code review comments Created 8 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « cc/scrollbar_animation_controller_linear_fade_unittest.cc ('k') | cc/single_thread_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "cc/scrollbar_layer.h" 7 #include "cc/scrollbar_layer.h"
8 8
9 #include "cc/scrollbar_animation_controller.h" 9 #include "cc/scrollbar_animation_controller.h"
10 #include "cc/scrollbar_layer_impl.h" 10 #include "cc/scrollbar_layer_impl.h"
(...skipping 27 matching lines...) Expand all
38 virtual ScrollbarControlSize controlSize() const OVERRIDE { return WebScroll bar::RegularScrollbar; } 38 virtual ScrollbarControlSize controlSize() const OVERRIDE { return WebScroll bar::RegularScrollbar; }
39 virtual ScrollbarPart pressedPart() const OVERRIDE { return WebScrollbar::No Part; } 39 virtual ScrollbarPart pressedPart() const OVERRIDE { return WebScrollbar::No Part; }
40 virtual ScrollbarPart hoveredPart() const OVERRIDE { return WebScrollbar::No Part; } 40 virtual ScrollbarPart hoveredPart() const OVERRIDE { return WebScrollbar::No Part; }
41 virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE { retur n WebScrollbar::ScrollbarOverlayStyleDefault; } 41 virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE { retur n WebScrollbar::ScrollbarOverlayStyleDefault; }
42 virtual bool isCustomScrollbar() const OVERRIDE { return false; } 42 virtual bool isCustomScrollbar() const OVERRIDE { return false; }
43 virtual Orientation orientation() const OVERRIDE { return WebScrollbar::Hori zontal; } 43 virtual Orientation orientation() const OVERRIDE { return WebScrollbar::Hori zontal; }
44 }; 44 };
45 45
46 TEST(ScrollbarLayerTest, resolveScrollLayerPointer) 46 TEST(ScrollbarLayerTest, resolveScrollLayerPointer)
47 { 47 {
48 DebugScopedSetImplThread impl;
49
50 WebKit::WebScrollbarThemePainter painter; 48 WebKit::WebScrollbarThemePainter painter;
51 49
52 { 50 {
53 scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create()); 51 scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create());
54 scoped_refptr<Layer> layerTreeRoot = Layer::create(); 52 scoped_refptr<Layer> layerTreeRoot = Layer::create();
55 scoped_refptr<Layer> child1 = Layer::create(); 53 scoped_refptr<Layer> child1 = Layer::create();
56 scoped_refptr<Layer> child2 = ScrollbarLayer::create(scrollbar.Pass(), p ainter, WebKit::FakeWebScrollbarThemeGeometry::create(), child1->id()); 54 scoped_refptr<Layer> child2 = ScrollbarLayer::create(scrollbar.Pass(), p ainter, WebKit::FakeWebScrollbarThemeGeometry::create(), child1->id());
57 layerTreeRoot->addChild(child1); 55 layerTreeRoot->addChild(child1);
58 layerTreeRoot->addChild(child2); 56 layerTreeRoot->addChild(child2);
59 57
(...skipping 19 matching lines...) Expand all
79 ScrollbarLayerImpl* ccChild1 = static_cast<ScrollbarLayerImpl*>(layerImp lTreeRoot->children()[0]); 77 ScrollbarLayerImpl* ccChild1 = static_cast<ScrollbarLayerImpl*>(layerImp lTreeRoot->children()[0]);
80 LayerImpl* ccChild2 = layerImplTreeRoot->children()[1]; 78 LayerImpl* ccChild2 = layerImplTreeRoot->children()[1];
81 79
82 EXPECT_TRUE(ccChild2->scrollbarAnimationController()); 80 EXPECT_TRUE(ccChild2->scrollbarAnimationController());
83 EXPECT_EQ(ccChild2->horizontalScrollbarLayer(), ccChild1); 81 EXPECT_EQ(ccChild2->horizontalScrollbarLayer(), ccChild1);
84 } 82 }
85 } 83 }
86 84
87 TEST(ScrollbarLayerTest, scrollOffsetSynchronization) 85 TEST(ScrollbarLayerTest, scrollOffsetSynchronization)
88 { 86 {
89 DebugScopedSetImplThread impl;
90
91 WebKit::WebScrollbarThemePainter painter; 87 WebKit::WebScrollbarThemePainter painter;
92 88
93 scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create()); 89 scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create());
94 scoped_refptr<Layer> layerTreeRoot = Layer::create(); 90 scoped_refptr<Layer> layerTreeRoot = Layer::create();
95 scoped_refptr<Layer> contentLayer = Layer::create(); 91 scoped_refptr<Layer> contentLayer = Layer::create();
96 scoped_refptr<Layer> scrollbarLayer = ScrollbarLayer::create(scrollbar.Pass( ), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), layerTreeRoot->id() ); 92 scoped_refptr<Layer> scrollbarLayer = ScrollbarLayer::create(scrollbar.Pass( ), painter, WebKit::FakeWebScrollbarThemeGeometry::create(), layerTreeRoot->id() );
97 layerTreeRoot->addChild(contentLayer); 93 layerTreeRoot->addChild(contentLayer);
98 layerTreeRoot->addChild(scrollbarLayer); 94 layerTreeRoot->addChild(scrollbarLayer);
99 95
100 layerTreeRoot->setScrollOffset(gfx::Vector2d(10, 20)); 96 layerTreeRoot->setScrollOffset(gfx::Vector2d(10, 20));
(...skipping 21 matching lines...) Expand all
122 EXPECT_EQ(300, ccScrollbarLayer->maximum()); 118 EXPECT_EQ(300, ccScrollbarLayer->maximum());
123 119
124 layerImplTreeRoot->scrollBy(gfx::Vector2d(12, 34)); 120 layerImplTreeRoot->scrollBy(gfx::Vector2d(12, 34));
125 121
126 EXPECT_EQ(112, ccScrollbarLayer->currentPos()); 122 EXPECT_EQ(112, ccScrollbarLayer->currentPos());
127 EXPECT_EQ(1000, ccScrollbarLayer->totalSize()); 123 EXPECT_EQ(1000, ccScrollbarLayer->totalSize());
128 EXPECT_EQ(300, ccScrollbarLayer->maximum()); 124 EXPECT_EQ(300, ccScrollbarLayer->maximum());
129 } 125 }
130 126
131 } // anonymous namespace 127 } // anonymous namespace
OLDNEW
« no previous file with comments | « cc/scrollbar_animation_controller_linear_fade_unittest.cc ('k') | cc/single_thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698