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

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

Issue 1775013004: Rename InputHandler::GESTURE to InputHandler::TOUCHSCREEN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_regression_3
Patch Set: Created 4 years, 9 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/input/input_handler.h ('k') | cc/trees/layer_tree_host_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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <unordered_map> 7 #include <unordered_map>
8 8
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "cc/input/scrollbar_animation_controller.h" 10 #include "cc/input/scrollbar_animation_controller.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 layer_impl_tree_root->layer_tree_impl()->BuildPropertyTreesForTesting(); 161 layer_impl_tree_root->layer_tree_impl()->BuildPropertyTreesForTesting();
162 ScrollTree& scroll_tree = 162 ScrollTree& scroll_tree =
163 layer_impl_tree_root->layer_tree_impl()->property_trees()->scroll_tree; 163 layer_impl_tree_root->layer_tree_impl()->property_trees()->scroll_tree;
164 ScrollNode* scroll_node = 164 ScrollNode* scroll_node =
165 scroll_tree.Node(scrollbar_layer_impl->scroll_tree_index()); 165 scroll_tree.Node(scrollbar_layer_impl->scroll_tree_index());
166 166
167 // When the scrollbar is not an overlay scrollbar, the scroll should be 167 // When the scrollbar is not an overlay scrollbar, the scroll should be
168 // responded to on the main thread as the compositor does not yet implement 168 // responded to on the main thread as the compositor does not yet implement
169 // scrollbar scrolling. 169 // scrollbar scrolling.
170 InputHandler::ScrollStatus status = layer_tree_host_->host_impl()->TryScroll( 170 InputHandler::ScrollStatus status = layer_tree_host_->host_impl()->TryScroll(
171 gfx::PointF(), InputHandler::GESTURE, scroll_tree, scroll_node); 171 gfx::PointF(), InputHandler::TOUCHSCREEN, scroll_tree, scroll_node);
172 EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, status.thread); 172 EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, status.thread);
173 EXPECT_EQ(MainThreadScrollingReason::kScrollbarScrolling, 173 EXPECT_EQ(MainThreadScrollingReason::kScrollbarScrolling,
174 status.main_thread_scrolling_reasons); 174 status.main_thread_scrolling_reasons);
175 175
176 // Create and attach an overlay scrollbar. 176 // Create and attach an overlay scrollbar.
177 scrollbar.reset(new FakeScrollbar(false, false, true)); 177 scrollbar.reset(new FakeScrollbar(false, false, true));
178 178
179 layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar( 179 layer_impl_tree_root = LayerImplForScrollAreaAndScrollbar(
180 layer_settings(), layer_tree_host_.get(), std::move(scrollbar), false, 180 layer_settings(), layer_tree_host_.get(), std::move(scrollbar), false,
181 false, 0, 0); 181 false, 0, 0);
182 scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>( 182 scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>(
183 layer_impl_tree_root->children()[1].get()); 183 layer_impl_tree_root->children()[1].get());
184 layer_impl_tree_root->layer_tree_impl()->BuildPropertyTreesForTesting(); 184 layer_impl_tree_root->layer_tree_impl()->BuildPropertyTreesForTesting();
185 scroll_tree = 185 scroll_tree =
186 layer_impl_tree_root->layer_tree_impl()->property_trees()->scroll_tree; 186 layer_impl_tree_root->layer_tree_impl()->property_trees()->scroll_tree;
187 scroll_node = scroll_tree.Node(scrollbar_layer_impl->scroll_tree_index()); 187 scroll_node = scroll_tree.Node(scrollbar_layer_impl->scroll_tree_index());
188 188
189 // The user shouldn't be able to drag an overlay scrollbar and the scroll 189 // The user shouldn't be able to drag an overlay scrollbar and the scroll
190 // may be handled in the compositor. 190 // may be handled in the compositor.
191 status = layer_tree_host_->host_impl()->TryScroll( 191 status = layer_tree_host_->host_impl()->TryScroll(
192 gfx::PointF(), InputHandler::GESTURE, scroll_tree, scroll_node); 192 gfx::PointF(), InputHandler::TOUCHSCREEN, scroll_tree, scroll_node);
193 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); 193 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread);
194 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable, 194 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable,
195 status.main_thread_scrolling_reasons); 195 status.main_thread_scrolling_reasons);
196 } 196 }
197 197
198 TEST_F(ScrollbarLayerTest, ScrollOffsetSynchronization) { 198 TEST_F(ScrollbarLayerTest, ScrollOffsetSynchronization) {
199 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar); 199 scoped_ptr<Scrollbar> scrollbar(new FakeScrollbar);
200 scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings()); 200 scoped_refptr<Layer> layer_tree_root = Layer::Create(layer_settings());
201 scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings()); 201 scoped_refptr<Layer> scroll_layer = Layer::Create(layer_settings());
202 scoped_refptr<Layer> content_layer = Layer::Create(layer_settings()); 202 scoped_refptr<Layer> content_layer = Layer::Create(layer_settings());
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); 1023 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f);
1024 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); 1024 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f);
1025 1025
1026 // Horizontal Scrollbars. 1026 // Horizontal Scrollbars.
1027 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); 1027 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f);
1028 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); 1028 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f);
1029 } 1029 }
1030 1030
1031 } // namespace 1031 } // namespace
1032 } // namespace cc 1032 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/input_handler.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698