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

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

Issue 2047093002: Remove enable/disable wheel gestures setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@can_scroll_remove
Patch Set: Remove unused, uninitialized variable on mac causing occasional failure 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 unified diff | 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 »
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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 host_impl_->ProcessScrollDeltas(); 756 host_impl_->ProcessScrollDeltas();
757 EXPECT_TRUE( 757 EXPECT_TRUE(
758 ScrollInfoContains(*scroll_info, scroll_layer->id(), scroll_delta)); 758 ScrollInfoContains(*scroll_info, scroll_layer->id(), scroll_delta));
759 } 759 }
760 760
761 TEST_F(LayerTreeHostImplTest, ScrollBlocksOnWheelEventHandlers) { 761 TEST_F(LayerTreeHostImplTest, ScrollBlocksOnWheelEventHandlers) {
762 SetupScrollAndContentsLayers(gfx::Size(100, 100)); 762 SetupScrollAndContentsLayers(gfx::Size(100, 100));
763 host_impl_->SetViewportSize(gfx::Size(50, 50)); 763 host_impl_->SetViewportSize(gfx::Size(50, 50));
764 DrawFrame(); 764 DrawFrame();
765 765
766 // With registered event handlers, wheel scrolls don't necessarily 766 // Wheel handlers determine whether mouse events block scroll.
767 // have to go to the main thread.
768 host_impl_->active_tree()->set_event_listener_properties( 767 host_impl_->active_tree()->set_event_listener_properties(
769 EventListenerClass::kMouseWheel, EventListenerProperties::kBlocking); 768 EventListenerClass::kMouseWheel, EventListenerProperties::kBlocking);
769 EXPECT_EQ(
770 EventListenerProperties::kBlocking,
771 host_impl_->GetEventListenerProperties(EventListenerClass::kMouseWheel));
772
773 // But they don't influence the actual handling of the scroll gestures.
770 InputHandler::ScrollStatus status = 774 InputHandler::ScrollStatus status =
771 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), 775 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
772 InputHandler::WHEEL); 776 InputHandler::WHEEL);
773 EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, status.thread);
774 EXPECT_EQ(MainThreadScrollingReason::kEventHandlers,
775 status.main_thread_scrolling_reasons);
776
777 host_impl_->active_tree()->set_event_listener_properties(
778 EventListenerClass::kMouseWheel,
779 EventListenerProperties::kBlockingAndPassive);
780 status = host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
781 InputHandler::WHEEL);
782 EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, status.thread);
783 EXPECT_EQ(MainThreadScrollingReason::kEventHandlers,
784 status.main_thread_scrolling_reasons);
785
786 // But gesture scrolls can still be handled.
787 status = host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
788 InputHandler::TOUCHSCREEN);
789 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
790 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
791 status.main_thread_scrolling_reasons);
792 host_impl_->ScrollEnd(EndState().get());
793
794 // And if the handlers go away, wheel scrolls can again be processed
795 // on impl.
796 host_impl_->active_tree()->set_event_listener_properties(
797 EventListenerClass::kMouseWheel, EventListenerProperties::kNone);
798 status = host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
799 InputHandler::WHEEL);
800 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 777 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
801 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 778 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
802 status.main_thread_scrolling_reasons); 779 status.main_thread_scrolling_reasons);
803 host_impl_->ScrollEnd(EndState().get()); 780 host_impl_->ScrollEnd(EndState().get());
804 } 781 }
805 782
806 TEST_F(LayerTreeHostImplTest, ScrollBlocksOnTouchEventHandlers) { 783 TEST_F(LayerTreeHostImplTest, ScrollBlocksOnTouchEventHandlers) {
807 LayerImpl* scroll = SetupScrollAndContentsLayers(gfx::Size(100, 100)); 784 LayerImpl* scroll = SetupScrollAndContentsLayers(gfx::Size(100, 100));
808 host_impl_->SetViewportSize(gfx::Size(50, 50)); 785 host_impl_->SetViewportSize(gfx::Size(50, 50));
809 DrawFrame(); 786 DrawFrame();
(...skipping 10009 matching lines...) Expand 10 before | Expand all | Expand 10 after
10819 10796
10820 // Re-initialize with a software output surface. 10797 // Re-initialize with a software output surface.
10821 output_surface_ = FakeOutputSurface::CreateSoftware( 10798 output_surface_ = FakeOutputSurface::CreateSoftware(
10822 base::WrapUnique(new SoftwareOutputDevice)); 10799 base::WrapUnique(new SoftwareOutputDevice));
10823 host_impl_->InitializeRenderer(output_surface_.get()); 10800 host_impl_->InitializeRenderer(output_surface_.get());
10824 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 10801 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
10825 } 10802 }
10826 10803
10827 } // namespace 10804 } // namespace
10828 } // namespace cc 10805 } // namespace cc
OLDNEW
« 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