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

Side by Side Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « cc/layers/scroll_blocks_on.h ('k') | cc/layers/texture_layer_impl.cc » ('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 "base/containers/hash_tables.h" 5 #include "base/containers/hash_tables.h"
6 #include "cc/animation/scrollbar_animation_controller.h" 6 #include "cc/animation/scrollbar_animation_controller.h"
7 #include "cc/layers/append_quads_data.h" 7 #include "cc/layers/append_quads_data.h"
8 #include "cc/layers/painted_scrollbar_layer.h" 8 #include "cc/layers/painted_scrollbar_layer.h"
9 #include "cc/layers/painted_scrollbar_layer_impl.h" 9 #include "cc/layers/painted_scrollbar_layer_impl.h"
10 #include "cc/layers/scrollbar_layer_interface.h" 10 #include "cc/layers/scrollbar_layer_interface.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); 166 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar);
167 LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( 167 LayerImpl* layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar(
168 layer_tree_host_.get(), scrollbar.Pass(), false, false, 0, 0); 168 layer_tree_host_.get(), scrollbar.Pass(), false, false, 0, 0);
169 PaintedScrollbarLayerImpl* scrollbar_layer_impl = 169 PaintedScrollbarLayerImpl* scrollbar_layer_impl =
170 static_cast<PaintedScrollbarLayerImpl*>( 170 static_cast<PaintedScrollbarLayerImpl*>(
171 layer_impl_tree_root->children()[1]); 171 layer_impl_tree_root->children()[1]);
172 172
173 // When the scrollbar is not an overlay scrollbar, the scroll should be 173 // When the scrollbar is not an overlay scrollbar, the scroll should be
174 // responded to on the main thread as the compositor does not yet implement 174 // responded to on the main thread as the compositor does not yet implement
175 // scrollbar scrolling. 175 // scrollbar scrolling.
176 EXPECT_EQ( 176 EXPECT_EQ(InputHandler::ScrollOnMainThread,
177 InputHandler::SCROLL_ON_MAIN_THREAD, 177 scrollbar_layer_impl->TryScroll(
178 scrollbar_layer_impl->TryScroll(gfx::Point(0, 0), InputHandler::GESTURE, 178 gfx::Point(0, 0), InputHandler::Gesture, ScrollBlocksOnNone));
179 SCROLL_BLOCKS_ON_NONE));
180 179
181 // Create and attach an overlay scrollbar. 180 // Create and attach an overlay scrollbar.
182 scrollbar.reset(new FakeScrollbar(false, false, true)); 181 scrollbar.reset(new FakeScrollbar(false, false, true));
183 182
184 layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( 183 layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar(
185 layer_tree_host_.get(), scrollbar.Pass(), false, false, 0, 0); 184 layer_tree_host_.get(), scrollbar.Pass(), false, false, 0, 0);
186 scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>( 185 scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>(
187 layer_impl_tree_root->children()[1]); 186 layer_impl_tree_root->children()[1]);
188 187
189 // The user shouldn't be able to drag an overlay scrollbar and the scroll 188 // The user shouldn't be able to drag an overlay scrollbar and the scroll
190 // may be handled in the compositor. 189 // may be handled in the compositor.
191 EXPECT_EQ( 190 EXPECT_EQ(InputHandler::ScrollIgnored,
192 InputHandler::SCROLL_IGNORED, 191 scrollbar_layer_impl->TryScroll(
193 scrollbar_layer_impl->TryScroll(gfx::Point(0, 0), InputHandler::GESTURE, 192 gfx::Point(0, 0), InputHandler::Gesture, ScrollBlocksOnNone));
194 SCROLL_BLOCKS_ON_NONE));
195 } 193 }
196 194
197 TEST_F(ScrollbarLayerTest, ScrollOffsetSynchronization) { 195 TEST_F(ScrollbarLayerTest, ScrollOffsetSynchronization) {
198 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); 196 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar);
199 scoped_refptr<Layer> layer_tree_root = Layer::Create(); 197 scoped_refptr<Layer> layer_tree_root = Layer::Create();
200 scoped_refptr<Layer> scroll_layer = Layer::Create(); 198 scoped_refptr<Layer> scroll_layer = Layer::Create();
201 scoped_refptr<Layer> content_layer = Layer::Create(); 199 scoped_refptr<Layer> content_layer = Layer::Create();
202 scoped_refptr<Layer> scrollbar_layer = 200 scoped_refptr<Layer> scrollbar_layer =
203 PaintedScrollbarLayer::Create(scrollbar.Pass(), layer_tree_root->id()); 201 PaintedScrollbarLayer::Create(scrollbar.Pass(), layer_tree_root->id());
204 202
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); 1055 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f);
1058 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); 1056 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f);
1059 1057
1060 // Horizontal Scrollbars. 1058 // Horizontal Scrollbars.
1061 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); 1059 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f);
1062 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); 1060 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f);
1063 } 1061 }
1064 1062
1065 } // namespace 1063 } // namespace
1066 } // namespace cc 1064 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/scroll_blocks_on.h ('k') | cc/layers/texture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698