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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2621133002: Return main thread scroll layer in FindScrollLayerForDeviceViewportPoint (Closed)
Patch Set: return current layer when it is main thread scrolling Created 3 years, 11 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') | no next file » | 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 761b4a6bd9e7dd4c561511e8a9e2d9102fbdd620..aea9e01d9da7bd16726bebddc1760a74f24c591e 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -464,6 +464,8 @@ class LayerTreeHostImplTest : public testing::Test,
void SetupMouseMoveAtWithDeviceScale(float device_scale_factor);
+ void SetupMouseMoveAtTestScrollbarStates(bool main_thread_scrolling);
+
scoped_refptr<AnimationTimeline> timeline() { return timeline_; }
protected:
@@ -11621,7 +11623,8 @@ TEST_F(LayerTreeHostImplTest, RecomputeGpuRasterOnCompositorFrameSinkChange) {
EXPECT_FALSE(host_impl_->use_gpu_rasterization());
}
-TEST_F(LayerTreeHostImplTest, LayerTreeHostImplTestScrollbarStates) {
+void LayerTreeHostImplTest::SetupMouseMoveAtTestScrollbarStates(
+ bool main_thread_scrolling) {
LayerTreeSettings settings = DefaultSettings();
settings.scrollbar_fade_delay = base::TimeDelta::FromMilliseconds(500);
settings.scrollbar_fade_duration = base::TimeDelta::FromMilliseconds(300);
@@ -11647,6 +11650,11 @@ TEST_F(LayerTreeHostImplTest, LayerTreeHostImplTestScrollbarStates) {
LayerImpl* root_scroll =
host_impl_->active_tree()->OuterViewportScrollLayer();
+ if (main_thread_scrolling) {
+ root_scroll->set_main_thread_scrolling_reasons(
+ MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects);
+ }
+
// scrollbar_1 on root scroll.
std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar_1 =
SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(),
@@ -11705,6 +11713,11 @@ TEST_F(LayerTreeHostImplTest, LayerTreeHostImplTestScrollbarStates) {
child->SetDrawsContent(true);
child->SetScrollClipLayer(child_clip_id);
+ if (main_thread_scrolling) {
+ child->set_main_thread_scrolling_reasons(
+ MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects);
+ }
+
scrollbar_2->SetScrollLayerId(child_scroll_id);
scrollbar_2->SetDrawsContent(true);
scrollbar_2->SetBounds(scrollbar_size_2);
@@ -11746,5 +11759,15 @@ TEST_F(LayerTreeHostImplTest, LayerTreeHostImplTestScrollbarStates) {
EXPECT_FALSE(scrollbar_2_animation_controller->mouse_is_over_scrollbar());
}
+TEST_F(LayerTreeHostImplTest,
+ LayerTreeHostImplTestScrollbarStatesInMainThreadScorlling) {
+ SetupMouseMoveAtTestScrollbarStates(true);
+}
+
+TEST_F(LayerTreeHostImplTest,
+ LayerTreeHostImplTestScrollbarStatesInNotMainThreadScorlling) {
+ SetupMouseMoveAtTestScrollbarStates(false);
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698