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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2096633002: Adds scroll position/scale emulation to DevTools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync changes from patches 2111203004 + 2118773002. 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
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 925993108a384d217951602c1ccae3945ff3af7a..09e34e74328d0f55a140d7d8bf3eb7663b32509a 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -6270,6 +6270,42 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) {
}
}
+TEST_F(LayerTreeHostImplTest, OverscrollOnMainThread) {
+ InputHandlerScrollResult scroll_result;
+ LayerTreeSettings settings = DefaultSettings();
+ CreateHostImpl(settings, CreateOutputSurface());
+
+ LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(50, 50));
+ scroll_layer->set_main_thread_scrolling_reasons(
+ MainThreadScrollingReason::kThreadedScrollingDisabled);
+
+ LayerImpl* clip_layer =
+ scroll_layer->test_properties()->parent->test_properties()->parent;
+ clip_layer->SetBounds(gfx::Size(50, 50));
+ host_impl_->active_tree()->BuildPropertyTreesForTesting();
+ host_impl_->SetViewportSize(gfx::Size(50, 50));
+ host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 4.f);
+ DrawFrame();
+
+ // Overscroll initiated outside layers will be handled by the main thread.
+ EXPECT_EQ(nullptr, host_impl_->active_tree()->FindLayerThatIsHitByPoint(
+ gfx::PointF(0, 60)));
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_
+ ->ScrollBegin(BeginState(gfx::Point(0, 60)).get(),
+ InputHandler::WHEEL)
+ .thread);
+
+ // Overscroll initiated inside layers will be handled by the main thread.
+ EXPECT_NE(nullptr, host_impl_->active_tree()->FindLayerThatIsHitByPoint(
+ gfx::PointF(0, 0)));
+ EXPECT_EQ(
+ InputHandler::SCROLL_ON_MAIN_THREAD,
+ host_impl_
+ ->ScrollBegin(BeginState(gfx::Point(0, 0)).get(), InputHandler::WHEEL)
+ .thread);
+}
+
class BlendStateCheckLayer : public LayerImpl {
public:
static std::unique_ptr<LayerImpl> Create(

Powered by Google App Engine
This is Rietveld 408576698