| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/events/blink/input_handler_proxy.h" | 5 #include "ui/events/blink/input_handler_proxy.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/test/histogram_tester.h" | 10 #include "base/test/histogram_tester.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 259 |
| 260 const cc::InputHandler::ScrollStatus kScrollIgnoredScrollState( | 260 const cc::InputHandler::ScrollStatus kScrollIgnoredScrollState( |
| 261 cc::InputHandler::SCROLL_IGNORED, | 261 cc::InputHandler::SCROLL_IGNORED, |
| 262 cc::MainThreadScrollingReason::kNotScrollable); | 262 cc::MainThreadScrollingReason::kNotScrollable); |
| 263 | 263 |
| 264 class TestInputHandlerProxy : public InputHandlerProxy { | 264 class TestInputHandlerProxy : public InputHandlerProxy { |
| 265 public: | 265 public: |
| 266 TestInputHandlerProxy(cc::InputHandler* input_handler, | 266 TestInputHandlerProxy(cc::InputHandler* input_handler, |
| 267 InputHandlerProxyClient* client) | 267 InputHandlerProxyClient* client) |
| 268 : InputHandlerProxy(input_handler, client) {} | 268 : InputHandlerProxy(input_handler, client) {} |
| 269 void RecordMainThreadScrollingReasonsForTest(blink::WebInputEvent::Type type, | 269 void RecordMainThreadScrollingReasonsForTest(blink::WebGestureDevice device, |
| 270 uint32_t reasons) { | 270 uint32_t reasons) { |
| 271 RecordMainThreadScrollingReasons(type, reasons); | 271 RecordMainThreadScrollingReasons(device, reasons); |
| 272 } | 272 } |
| 273 }; | 273 }; |
| 274 | 274 |
| 275 } // namespace | 275 } // namespace |
| 276 | 276 |
| 277 class InputHandlerProxyTest | 277 class InputHandlerProxyTest |
| 278 : public testing::Test, | 278 : public testing::Test, |
| 279 public testing::WithParamInterface<InputHandlerProxyTestType> { | 279 public testing::WithParamInterface<InputHandlerProxyTestType> { |
| 280 public: | 280 public: |
| 281 InputHandlerProxyTest() | 281 InputHandlerProxyTest() |
| (...skipping 2558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2840 gfx::ScrollOffset(5, 6))); | 2840 gfx::ScrollOffset(5, 6))); |
| 2841 proxy.SynchronouslySetRootScrollOffset(gfx::ScrollOffset(5, 6)); | 2841 proxy.SynchronouslySetRootScrollOffset(gfx::ScrollOffset(5, 6)); |
| 2842 | 2842 |
| 2843 testing::Mock::VerifyAndClearExpectations(&mock_input_handler); | 2843 testing::Mock::VerifyAndClearExpectations(&mock_input_handler); |
| 2844 testing::Mock::VerifyAndClearExpectations(&mock_client); | 2844 testing::Mock::VerifyAndClearExpectations(&mock_client); |
| 2845 testing::Mock::VerifyAndClearExpectations(&mock_synchronous_input_handler); | 2845 testing::Mock::VerifyAndClearExpectations(&mock_synchronous_input_handler); |
| 2846 } | 2846 } |
| 2847 | 2847 |
| 2848 TEST_P(InputHandlerProxyTest, MainThreadScrollingMouseWheelHistograms) { | 2848 TEST_P(InputHandlerProxyTest, MainThreadScrollingMouseWheelHistograms) { |
| 2849 input_handler_->RecordMainThreadScrollingReasonsForTest( | 2849 input_handler_->RecordMainThreadScrollingReasonsForTest( |
| 2850 WebInputEvent::MouseWheel, | 2850 blink::WebGestureDeviceTouchpad, |
| 2851 cc::MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects | | 2851 cc::MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects | |
| 2852 cc::MainThreadScrollingReason::kThreadedScrollingDisabled | | 2852 cc::MainThreadScrollingReason::kThreadedScrollingDisabled | |
| 2853 cc::MainThreadScrollingReason::kPageOverlay | | 2853 cc::MainThreadScrollingReason::kPageOverlay | |
| 2854 cc::MainThreadScrollingReason::kAnimatingScrollOnMainThread); | 2854 cc::MainThreadScrollingReason::kAnimatingScrollOnMainThread); |
| 2855 | 2855 |
| 2856 EXPECT_THAT( | 2856 EXPECT_THAT( |
| 2857 histogram_tester().GetAllSamples("Renderer4.MainThreadWheelScrollReason"), | 2857 histogram_tester().GetAllSamples("Renderer4.MainThreadWheelScrollReason"), |
| 2858 testing::ElementsAre(base::Bucket(1, 1), base::Bucket(3, 1), | 2858 testing::ElementsAre(base::Bucket(1, 1), base::Bucket(3, 1), |
| 2859 base::Bucket(5, 1), base::Bucket(14, 1))); | 2859 base::Bucket(5, 1), base::Bucket(14, 1))); |
| 2860 } | 2860 } |
| 2861 | 2861 |
| 2862 | 2862 |
| 2863 INSTANTIATE_TEST_CASE_P(AnimateInput, | 2863 INSTANTIATE_TEST_CASE_P(AnimateInput, |
| 2864 InputHandlerProxyTest, | 2864 InputHandlerProxyTest, |
| 2865 testing::ValuesIn(test_types)); | 2865 testing::ValuesIn(test_types)); |
| 2866 } // namespace test | 2866 } // namespace test |
| 2867 } // namespace ui | 2867 } // namespace ui |
| OLD | NEW |