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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2050033002: Revert of Remove enable/disable wheel gestures setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@can_scroll_remove
Patch Set: Created 4 years, 6 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 | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_settings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 4972bb1b90a42cebaaa3a88fdb04f4c423ce648c..16656d49a71678c2c5856d2cd9ba7e337bc1be9d 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -765,16 +765,39 @@
host_impl_->SetViewportSize(gfx::Size(50, 50));
DrawFrame();
- // Wheel handlers determine whether mouse events block scroll.
+ // With registered event handlers, wheel scrolls don't necessarily
+ // have to go to the main thread.
host_impl_->active_tree()->set_event_listener_properties(
EventListenerClass::kMouseWheel, EventListenerProperties::kBlocking);
- EXPECT_EQ(
- EventListenerProperties::kBlocking,
- host_impl_->GetEventListenerProperties(EventListenerClass::kMouseWheel));
-
- // But they don't influence the actual handling of the scroll gestures.
InputHandler::ScrollStatus status =
host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL);
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, status.thread);
+ EXPECT_EQ(MainThreadScrollingReason::kEventHandlers,
+ status.main_thread_scrolling_reasons);
+
+ host_impl_->active_tree()->set_event_listener_properties(
+ EventListenerClass::kMouseWheel,
+ EventListenerProperties::kBlockingAndPassive);
+ status = host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL);
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, status.thread);
+ EXPECT_EQ(MainThreadScrollingReason::kEventHandlers,
+ status.main_thread_scrolling_reasons);
+
+ // But gesture scrolls can still be handled.
+ status = host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::TOUCHSCREEN);
+ EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
+ EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
+ status.main_thread_scrolling_reasons);
+ host_impl_->ScrollEnd(EndState().get());
+
+ // And if the handlers go away, wheel scrolls can again be processed
+ // on impl.
+ host_impl_->active_tree()->set_event_listener_properties(
+ EventListenerClass::kMouseWheel, EventListenerProperties::kNone);
+ status = host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
InputHandler::WHEEL);
EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698