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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2256733003: Touchpad scroll latching enabled for Mac behind flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ClearCurrentlyScrollingLayerForTesting added. Created 4 years, 3 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/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest_scroll.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 689 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
690 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 690 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
691 status.main_thread_scrolling_reasons); 691 status.main_thread_scrolling_reasons);
692 692
693 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), 693 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
694 InputHandler::WHEEL)); 694 InputHandler::WHEEL));
695 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get()); 695 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
696 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, 10), 696 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, 10),
697 InputHandler::WHEEL)); 697 InputHandler::WHEEL));
698 host_impl_->ScrollEnd(EndState().get()); 698 host_impl_->ScrollEnd(EndState().get());
699 host_impl_->ClearCurrentlyScrollingLayerForTesting();
699 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), 700 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
700 InputHandler::WHEEL)); 701 InputHandler::WHEEL));
701 EXPECT_TRUE(did_request_redraw_); 702 EXPECT_TRUE(did_request_redraw_);
702 EXPECT_TRUE(did_request_commit_); 703 EXPECT_TRUE(did_request_commit_);
703 } 704 }
704 705
705 TEST_F(LayerTreeHostImplTest, ScrollActiveOnlyAfterScrollMovement) { 706 TEST_F(LayerTreeHostImplTest, ScrollActiveOnlyAfterScrollMovement) {
706 SetupScrollAndContentsLayers(gfx::Size(100, 100)); 707 SetupScrollAndContentsLayers(gfx::Size(100, 100));
707 host_impl_->active_tree()->BuildPropertyTreesForTesting(); 708 host_impl_->active_tree()->BuildPropertyTreesForTesting();
708 709
709 host_impl_->SetViewportSize(gfx::Size(50, 50)); 710 host_impl_->SetViewportSize(gfx::Size(50, 50));
710 DrawFrame(); 711 DrawFrame();
711 712
712 InputHandler::ScrollStatus status = host_impl_->ScrollBegin( 713 InputHandler::ScrollStatus status = host_impl_->ScrollBegin(
713 BeginState(gfx::Point()).get(), InputHandler::WHEEL); 714 BeginState(gfx::Point()).get(), InputHandler::WHEEL);
714 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 715 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
715 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 716 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
716 status.main_thread_scrolling_reasons); 717 status.main_thread_scrolling_reasons);
717 718
718 EXPECT_FALSE(host_impl_->IsActivelyScrolling()); 719 EXPECT_FALSE(host_impl_->IsActivelyScrolling());
719 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get()); 720 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
720 EXPECT_TRUE(host_impl_->IsActivelyScrolling()); 721 EXPECT_TRUE(host_impl_->IsActivelyScrolling());
721 host_impl_->ScrollEnd(EndState().get()); 722 host_impl_->ScrollEnd(EndState().get());
723 host_impl_->ClearCurrentlyScrollingLayerForTesting();
722 EXPECT_FALSE(host_impl_->IsActivelyScrolling()); 724 EXPECT_FALSE(host_impl_->IsActivelyScrolling());
723 } 725 }
724 726
725 TEST_F(LayerTreeHostImplTest, ScrollWithoutRootLayer) { 727 TEST_F(LayerTreeHostImplTest, ScrollWithoutRootLayer) {
726 // We should not crash when trying to scroll an empty layer tree. 728 // We should not crash when trying to scroll an empty layer tree.
727 InputHandler::ScrollStatus status = host_impl_->ScrollBegin( 729 InputHandler::ScrollStatus status = host_impl_->ScrollBegin(
728 BeginState(gfx::Point()).get(), InputHandler::WHEEL); 730 BeginState(gfx::Point()).get(), InputHandler::WHEEL);
729 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); 731 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread);
730 EXPECT_EQ(MainThreadScrollingReason::kNoScrollingLayer, 732 EXPECT_EQ(MainThreadScrollingReason::kNoScrollingLayer,
731 status.main_thread_scrolling_reasons); 733 status.main_thread_scrolling_reasons);
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 1040 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
1039 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 1041 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
1040 status.main_thread_scrolling_reasons); 1042 status.main_thread_scrolling_reasons);
1041 1043
1042 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt( 1044 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(
1043 gfx::Point(75, 75), InputHandler::TOUCHSCREEN)); 1045 gfx::Point(75, 75), InputHandler::TOUCHSCREEN));
1044 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get()); 1046 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
1045 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt( 1047 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
1046 gfx::Point(25, 25), InputHandler::TOUCHSCREEN)); 1048 gfx::Point(25, 25), InputHandler::TOUCHSCREEN));
1047 host_impl_->ScrollEnd(EndState().get()); 1049 host_impl_->ScrollEnd(EndState().get());
1050 host_impl_->ClearCurrentlyScrollingLayerForTesting();
1048 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt( 1051 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
1049 gfx::Point(75, 75), InputHandler::TOUCHSCREEN)); 1052 gfx::Point(75, 75), InputHandler::TOUCHSCREEN));
1050 1053
1051 status = host_impl_->ScrollBegin(BeginState(gfx::Point(75, 75)).get(), 1054 status = host_impl_->ScrollBegin(BeginState(gfx::Point(75, 75)).get(),
1052 InputHandler::TOUCHSCREEN); 1055 InputHandler::TOUCHSCREEN);
1053 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 1056 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
1054 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 1057 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
1055 status.main_thread_scrolling_reasons); 1058 status.main_thread_scrolling_reasons);
1056 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt( 1059 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(
1057 gfx::Point(75, 75), InputHandler::TOUCHSCREEN)); 1060 gfx::Point(75, 75), InputHandler::TOUCHSCREEN));
1058 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get()); 1061 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
1059 host_impl_->ScrollEnd(EndState().get()); 1062 host_impl_->ScrollEnd(EndState().get());
1063 host_impl_->ClearCurrentlyScrollingLayerForTesting();
1060 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt( 1064 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
1061 gfx::Point(75, 75), InputHandler::TOUCHSCREEN)); 1065 gfx::Point(75, 75), InputHandler::TOUCHSCREEN));
1062 } 1066 }
1063 1067
1064 TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionWithOffset) { 1068 TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionWithOffset) {
1065 SetupScrollAndContentsLayers(gfx::Size(200, 200)); 1069 SetupScrollAndContentsLayers(gfx::Size(200, 200));
1066 host_impl_->SetViewportSize(gfx::Size(100, 100)); 1070 host_impl_->SetViewportSize(gfx::Size(100, 100));
1067 1071
1068 LayerImpl* root = *host_impl_->active_tree()->begin(); 1072 LayerImpl* root = *host_impl_->active_tree()->begin();
1069 root->SetNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50)); 1073 root->SetNonFastScrollableRegion(gfx::Rect(0, 0, 50, 50));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 SetupScrollAndContentsLayers(gfx::Size(200, 200)); 1116 SetupScrollAndContentsLayers(gfx::Size(200, 200));
1113 host_impl_->active_tree()->set_have_scroll_event_handlers(true); 1117 host_impl_->active_tree()->set_have_scroll_event_handlers(true);
1114 host_impl_->SetViewportSize(gfx::Size(50, 50)); 1118 host_impl_->SetViewportSize(gfx::Size(50, 50));
1115 DrawFrame(); 1119 DrawFrame();
1116 1120
1117 EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler()); 1121 EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
1118 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), 1122 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
1119 InputHandler::TOUCHSCREEN); 1123 InputHandler::TOUCHSCREEN);
1120 EXPECT_TRUE(host_impl_->scroll_affects_scroll_handler()); 1124 EXPECT_TRUE(host_impl_->scroll_affects_scroll_handler());
1121 host_impl_->ScrollEnd(EndState().get()); 1125 host_impl_->ScrollEnd(EndState().get());
1126 host_impl_->ClearCurrentlyScrollingLayerForTesting();
1122 EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler()); 1127 EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
1123 } 1128 }
1124 1129
1125 TEST_F(LayerTreeHostImplTest, ScrollByReturnsCorrectValue) { 1130 TEST_F(LayerTreeHostImplTest, ScrollByReturnsCorrectValue) {
1126 SetupScrollAndContentsLayers(gfx::Size(200, 200)); 1131 SetupScrollAndContentsLayers(gfx::Size(200, 200));
1127 host_impl_->SetViewportSize(gfx::Size(100, 100)); 1132 host_impl_->SetViewportSize(gfx::Size(100, 100));
1128 1133
1129 DrawFrame(); 1134 DrawFrame();
1130 1135
1131 InputHandler::ScrollStatus status = host_impl_->ScrollBegin( 1136 InputHandler::ScrollStatus status = host_impl_->ScrollBegin(
(...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after
2818 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), 2823 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
2819 InputHandler::WHEEL); 2824 InputHandler::WHEEL);
2820 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 5)).get()); 2825 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 5)).get());
2821 EXPECT_FALSE(did_request_next_frame_); 2826 EXPECT_FALSE(did_request_next_frame_);
2822 EXPECT_TRUE(did_request_redraw_); 2827 EXPECT_TRUE(did_request_redraw_);
2823 did_request_redraw_ = false; 2828 did_request_redraw_ = false;
2824 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); 2829 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
2825 EXPECT_TRUE(animation_task_.Equals(base::Closure())); 2830 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
2826 2831
2827 host_impl_->ScrollEnd(EndState().get()); 2832 host_impl_->ScrollEnd(EndState().get());
2833 host_impl_->ClearCurrentlyScrollingLayerForTesting();
2828 EXPECT_FALSE(did_request_next_frame_); 2834 EXPECT_FALSE(did_request_next_frame_);
2829 EXPECT_FALSE(did_request_redraw_); 2835 EXPECT_FALSE(did_request_redraw_);
2830 if (expecting_animations) { 2836 if (expecting_animations) {
2831 EXPECT_EQ(base::TimeDelta::FromMilliseconds(20), 2837 EXPECT_EQ(base::TimeDelta::FromMilliseconds(20),
2832 requested_animation_delay_); 2838 requested_animation_delay_);
2833 EXPECT_FALSE(animation_task_.Equals(base::Closure())); 2839 EXPECT_FALSE(animation_task_.Equals(base::Closure()));
2834 } else { 2840 } else {
2835 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); 2841 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
2836 EXPECT_TRUE(animation_task_.Equals(base::Closure())); 2842 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
2837 } 2843 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2912 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), 2918 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
2913 InputHandler::WHEEL); 2919 InputHandler::WHEEL);
2914 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(5, 0)).get()); 2920 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(5, 0)).get());
2915 EXPECT_FALSE(did_request_next_frame_); 2921 EXPECT_FALSE(did_request_next_frame_);
2916 EXPECT_TRUE(did_request_redraw_); 2922 EXPECT_TRUE(did_request_redraw_);
2917 did_request_redraw_ = false; 2923 did_request_redraw_ = false;
2918 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); 2924 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
2919 EXPECT_TRUE(animation_task_.Equals(base::Closure())); 2925 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
2920 2926
2921 host_impl_->ScrollEnd(EndState().get()); 2927 host_impl_->ScrollEnd(EndState().get());
2928 host_impl_->ClearCurrentlyScrollingLayerForTesting();
2922 EXPECT_FALSE(did_request_next_frame_); 2929 EXPECT_FALSE(did_request_next_frame_);
2923 EXPECT_FALSE(did_request_redraw_); 2930 EXPECT_FALSE(did_request_redraw_);
2924 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_); 2931 EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
2925 EXPECT_TRUE(animation_task_.Equals(base::Closure())); 2932 EXPECT_TRUE(animation_task_.Equals(base::Closure()));
2926 2933
2927 // Changing page scale triggers scrollbar animation. 2934 // Changing page scale triggers scrollbar animation.
2928 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); 2935 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f);
2929 host_impl_->active_tree()->SetPageScaleOnActiveTree(1.1f); 2936 host_impl_->active_tree()->SetPageScaleOnActiveTree(1.1f);
2930 EXPECT_FALSE(did_request_next_frame_); 2937 EXPECT_FALSE(did_request_next_frame_);
2931 EXPECT_FALSE(did_request_redraw_); 2938 EXPECT_FALSE(did_request_redraw_);
(...skipping 6424 matching lines...) Expand 10 before | Expand all | Expand 10 after
9356 host_impl_->FlingScrollBegin().thread); 9363 host_impl_->FlingScrollBegin().thread);
9357 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer()); 9364 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
9358 9365
9359 gfx::Vector2d scroll_delta(inner_viewport.width() / 2.f, 9366 gfx::Vector2d scroll_delta(inner_viewport.width() / 2.f,
9360 inner_viewport.height() / 2.f); 9367 inner_viewport.height() / 2.f);
9361 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); 9368 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
9362 inner_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y()); 9369 inner_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y());
9363 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer()); 9370 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
9364 9371
9365 host_impl_->ScrollEnd(EndState().get()); 9372 host_impl_->ScrollEnd(EndState().get());
9373 host_impl_->ClearCurrentlyScrollingLayerForTesting();
9366 EXPECT_EQ(nullptr, host_impl_->CurrentlyScrollingLayer()); 9374 EXPECT_EQ(nullptr, host_impl_->CurrentlyScrollingLayer());
9367 9375
9368 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset()); 9376 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset());
9369 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset()); 9377 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset());
9370 9378
9371 // Fling past the inner viewport boundry, make sure outer viewport scrolls. 9379 // Fling past the inner viewport boundry, make sure outer viewport scrolls.
9372 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, 9380 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
9373 host_impl_ 9381 host_impl_
9374 ->ScrollBegin(BeginState(gfx::Point()).get(), 9382 ->ScrollBegin(BeginState(gfx::Point()).get(),
9375 InputHandler::TOUCHSCREEN) 9383 InputHandler::TOUCHSCREEN)
9376 .thread); 9384 .thread);
9377 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer()); 9385 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
9378 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, 9386 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
9379 host_impl_->FlingScrollBegin().thread); 9387 host_impl_->FlingScrollBegin().thread);
9380 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer()); 9388 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
9381 9389
9382 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); 9390 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
9383 inner_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y()); 9391 inner_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y());
9384 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer()); 9392 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
9385 9393
9386 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()); 9394 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
9387 outer_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y()); 9395 outer_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y());
9388 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer()); 9396 EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
9389 9397
9390 host_impl_->ScrollEnd(EndState().get()); 9398 host_impl_->ScrollEnd(EndState().get());
9399 host_impl_->ClearCurrentlyScrollingLayerForTesting();
9391 EXPECT_EQ(nullptr, host_impl_->CurrentlyScrollingLayer()); 9400 EXPECT_EQ(nullptr, host_impl_->CurrentlyScrollingLayer());
9392 9401
9393 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset()); 9402 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset());
9394 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset()); 9403 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset());
9395 } 9404 }
9396 } 9405 }
9397 9406
9398 TEST_F(LayerTreeHostImplVirtualViewportTest, 9407 TEST_F(LayerTreeHostImplVirtualViewportTest,
9399 DiagonalScrollBubblesPerfectlyToInner) { 9408 DiagonalScrollBubblesPerfectlyToInner) {
9400 gfx::Size content_size = gfx::Size(200, 320); 9409 gfx::Size content_size = gfx::Size(200, 320);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
9438 // Now diagonal scroll across the outer viewport boundary in a single event. 9447 // Now diagonal scroll across the outer viewport boundary in a single event.
9439 // The entirety of the scroll should be consumed, as bubbling between inner 9448 // The entirety of the scroll should be consumed, as bubbling between inner
9440 // and outer viewport layers is perfect. 9449 // and outer viewport layers is perfect.
9441 host_impl_->ScrollBy( 9450 host_impl_->ScrollBy(
9442 UpdateState(gfx::Point(), gfx::ScaleVector2d(scroll_delta, 2)).get()); 9451 UpdateState(gfx::Point(), gfx::ScaleVector2d(scroll_delta, 2)).get());
9443 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt( 9452 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(
9444 gfx::Point(), InputHandler::TOUCHSCREEN)); 9453 gfx::Point(), InputHandler::TOUCHSCREEN));
9445 outer_expected += scroll_delta; 9454 outer_expected += scroll_delta;
9446 inner_expected += scroll_delta; 9455 inner_expected += scroll_delta;
9447 host_impl_->ScrollEnd(EndState().get()); 9456 host_impl_->ScrollEnd(EndState().get());
9457 host_impl_->ClearCurrentlyScrollingLayerForTesting();
9448 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt( 9458 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
9449 gfx::Point(), InputHandler::TOUCHSCREEN)); 9459 gfx::Point(), InputHandler::TOUCHSCREEN));
9450 9460
9451 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset()); 9461 EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset());
9452 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset()); 9462 EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset());
9453 } 9463 }
9454 } 9464 }
9455 9465
9456 TEST_F(LayerTreeHostImplVirtualViewportTest, 9466 TEST_F(LayerTreeHostImplVirtualViewportTest,
9457 TouchFlingDoesntSwitchScrollingLayer) { 9467 TouchFlingDoesntSwitchScrollingLayer) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
9510 EXPECT_TRUE( 9520 EXPECT_TRUE(
9511 ScrollInfoContains(*scroll_info, child_scroll->id(), scroll_delta)); 9521 ScrollInfoContains(*scroll_info, child_scroll->id(), scroll_delta));
9512 ExpectNone(*scroll_info, inner_scroll->id()); 9522 ExpectNone(*scroll_info, inner_scroll->id());
9513 9523
9514 // As the locked layer is at its limit, no further scrolling can occur. 9524 // As the locked layer is at its limit, no further scrolling can occur.
9515 EXPECT_FALSE( 9525 EXPECT_FALSE(
9516 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get()) 9526 host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get())
9517 .did_scroll); 9527 .did_scroll);
9518 EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child_scroll); 9528 EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child_scroll);
9519 host_impl_->ScrollEnd(EndState().get()); 9529 host_impl_->ScrollEnd(EndState().get());
9530 host_impl_->ClearCurrentlyScrollingLayerForTesting();
9520 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt( 9531 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
9521 gfx::Point(), InputHandler::TOUCHSCREEN)); 9532 gfx::Point(), InputHandler::TOUCHSCREEN));
9522 } 9533 }
9523 } 9534 }
9524 9535
9525 TEST_F(LayerTreeHostImplVirtualViewportTest, 9536 TEST_F(LayerTreeHostImplVirtualViewportTest,
9526 ScrollBeginEventThatTargetsViewportLayerSkipsHitTest) { 9537 ScrollBeginEventThatTargetsViewportLayerSkipsHitTest) {
9527 gfx::Size content_size = gfx::Size(100, 160); 9538 gfx::Size content_size = gfx::Size(100, 160);
9528 gfx::Size outer_viewport = gfx::Size(50, 80); 9539 gfx::Size outer_viewport = gfx::Size(50, 80);
9529 gfx::Size inner_viewport = gfx::Size(25, 40); 9540 gfx::Size inner_viewport = gfx::Size(25, 40);
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
10093 InputHandler::WHEEL) 10104 InputHandler::WHEEL)
10094 .thread); 10105 .thread);
10095 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, y), 10106 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, y),
10096 InputHandler::WHEEL)); 10107 InputHandler::WHEEL));
10097 host_impl_->ScrollBy( 10108 host_impl_->ScrollBy(
10098 UpdateState(gfx::Point(0, y), gfx::Vector2d(0, 50)).get()); 10109 UpdateState(gfx::Point(0, y), gfx::Vector2d(0, 50)).get());
10099 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, y + 50), 10110 EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, y + 50),
10100 InputHandler::WHEEL)); 10111 InputHandler::WHEEL));
10101 std::unique_ptr<ScrollState> scroll_state_end = EndState(); 10112 std::unique_ptr<ScrollState> scroll_state_end = EndState();
10102 host_impl_->ScrollEnd(scroll_state_end.get()); 10113 host_impl_->ScrollEnd(scroll_state_end.get());
10114 host_impl_->ClearCurrentlyScrollingLayerForTesting();
10103 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(), 10115 EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
10104 InputHandler::WHEEL)); 10116 InputHandler::WHEEL));
10105 10117
10106 // The instant scroll should have marked the smooth scroll animation as 10118 // The instant scroll should have marked the smooth scroll animation as
10107 // aborted. 10119 // aborted.
10108 EXPECT_FALSE(host_impl_->animation_host()->HasActiveAnimationForTesting( 10120 EXPECT_FALSE(host_impl_->animation_host()->HasActiveAnimationForTesting(
10109 scrolling_layer->element_id())); 10121 scrolling_layer->element_id()));
10110 10122
10111 EXPECT_VECTOR2DF_EQ(gfx::ScrollOffset(0, y + 50), 10123 EXPECT_VECTOR2DF_EQ(gfx::ScrollOffset(0, y + 50),
10112 scrolling_layer->CurrentScrollOffset()); 10124 scrolling_layer->CurrentScrollOffset());
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
11138 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); 11150 EXPECT_TRUE(host_impl_->use_gpu_rasterization());
11139 11151
11140 // Re-initialize with a software output surface. 11152 // Re-initialize with a software output surface.
11141 output_surface_ = FakeOutputSurface::CreateDelegatingSoftware(); 11153 output_surface_ = FakeOutputSurface::CreateDelegatingSoftware();
11142 host_impl_->InitializeRenderer(output_surface_.get()); 11154 host_impl_->InitializeRenderer(output_surface_.get());
11143 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 11155 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
11144 } 11156 }
11145 11157
11146 } // namespace 11158 } // namespace
11147 } // namespace cc 11159 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698