| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 3007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3018 | 3018 |
| 3019 EXPECT_CALL(mock_input_handler, SetSynchronousInputHandlerRootScrollOffset( | 3019 EXPECT_CALL(mock_input_handler, SetSynchronousInputHandlerRootScrollOffset( |
| 3020 gfx::ScrollOffset(5, 6))); | 3020 gfx::ScrollOffset(5, 6))); |
| 3021 proxy.SynchronouslySetRootScrollOffset(gfx::ScrollOffset(5, 6)); | 3021 proxy.SynchronouslySetRootScrollOffset(gfx::ScrollOffset(5, 6)); |
| 3022 | 3022 |
| 3023 testing::Mock::VerifyAndClearExpectations(&mock_input_handler); | 3023 testing::Mock::VerifyAndClearExpectations(&mock_input_handler); |
| 3024 testing::Mock::VerifyAndClearExpectations(&mock_client); | 3024 testing::Mock::VerifyAndClearExpectations(&mock_client); |
| 3025 testing::Mock::VerifyAndClearExpectations(&mock_synchronous_input_handler); | 3025 testing::Mock::VerifyAndClearExpectations(&mock_synchronous_input_handler); |
| 3026 } | 3026 } |
| 3027 | 3027 |
| 3028 TEST_P(InputHandlerProxyTest, MainThreadScrollingMouseWheelHistograms) { | 3028 // Only test NotScrollingOnMain, the actual main thread scrolling reasons |
| 3029 // are tested in EventHandlerTest.MainThreadScrollingReasonRecordTest |
| 3030 TEST_P(InputHandlerProxyTest, MainThreadScrollingReasonHistograms) { |
| 3031 // Test wheel scroll |
| 3029 input_handler_->RecordMainThreadScrollingReasonsForTest( | 3032 input_handler_->RecordMainThreadScrollingReasonsForTest( |
| 3030 blink::WebGestureDeviceTouchpad, | 3033 blink::WebGestureDeviceTouchpad, |
| 3031 cc::MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects | | 3034 cc::MainThreadScrollingReason::kNotScrollingOnMain); |
| 3032 cc::MainThreadScrollingReason::kThreadedScrollingDisabled | | |
| 3033 cc::MainThreadScrollingReason::kPageOverlay | | |
| 3034 cc::MainThreadScrollingReason::kHandlingScrollFromMainThread); | |
| 3035 | 3035 |
| 3036 EXPECT_THAT( | 3036 EXPECT_THAT( |
| 3037 histogram_tester().GetAllSamples("Renderer4.MainThreadWheelScrollReason"), | 3037 histogram_tester().GetAllSamples("Renderer4.MainThreadWheelScrollReason"), |
| 3038 testing::ElementsAre(base::Bucket(1, 1), base::Bucket(3, 1), | 3038 testing::ElementsAre(base::Bucket(0, 1))); |
| 3039 base::Bucket(5, 1))); | |
| 3040 | 3039 |
| 3041 // We only want to record "Handling scroll from main thread" reason if it's | 3040 // Test touch scroll |
| 3042 // the only reason. If it's not the only reason, the "real" reason for | |
| 3043 // scrolling on main is something else, and we only want to pay attention to | |
| 3044 // that reason. So we should only include this reason in the histogram when | |
| 3045 // its on its own. | |
| 3046 input_handler_->RecordMainThreadScrollingReasonsForTest( | 3041 input_handler_->RecordMainThreadScrollingReasonsForTest( |
| 3047 blink::WebGestureDeviceTouchpad, | 3042 blink::WebGestureDeviceTouchscreen, |
| 3048 cc::MainThreadScrollingReason::kHandlingScrollFromMainThread); | 3043 cc::MainThreadScrollingReason::kNotScrollingOnMain); |
| 3049 | 3044 |
| 3050 EXPECT_THAT( | 3045 EXPECT_THAT(histogram_tester().GetAllSamples( |
| 3051 histogram_tester().GetAllSamples("Renderer4.MainThreadWheelScrollReason"), | 3046 "Renderer4.MainThreadGestureScrollReason"), |
| 3052 testing::ElementsAre(base::Bucket(1, 1), base::Bucket(3, 1), | 3047 testing::ElementsAre(base::Bucket(0, 1))); |
| 3053 base::Bucket(5, 1), base::Bucket(14, 1))); | |
| 3054 } | 3048 } |
| 3055 | 3049 |
| 3056 TEST_P(InputHandlerProxyTest, GestureScrollingThreadStatusHistogram) { | 3050 TEST_P(InputHandlerProxyTest, GestureScrollingThreadStatusHistogram) { |
| 3057 VERIFY_AND_RESET_MOCKS(); | 3051 VERIFY_AND_RESET_MOCKS(); |
| 3058 | 3052 |
| 3059 WebTouchEvent touch_start(WebInputEvent::TouchStart, | 3053 WebTouchEvent touch_start(WebInputEvent::TouchStart, |
| 3060 WebInputEvent::NoModifiers, | 3054 WebInputEvent::NoModifiers, |
| 3061 WebInputEvent::TimeStampForTesting); | 3055 WebInputEvent::TimeStampForTesting); |
| 3062 touch_start.touchesLength = 1; | 3056 touch_start.touchesLength = 1; |
| 3063 touch_start.touches[0] = | 3057 touch_start.touches[0] = |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3617 HandleGestureEvent(WebInputEvent::GestureScrollBegin); | 3611 HandleGestureEvent(WebInputEvent::GestureScrollBegin); |
| 3618 EXPECT_EQ(0ul, event_queue().size()); | 3612 EXPECT_EQ(0ul, event_queue().size()); |
| 3619 } | 3613 } |
| 3620 | 3614 |
| 3621 INSTANTIATE_TEST_CASE_P(AnimateInput, | 3615 INSTANTIATE_TEST_CASE_P(AnimateInput, |
| 3622 InputHandlerProxyTest, | 3616 InputHandlerProxyTest, |
| 3623 testing::ValuesIn(test_types)); | 3617 testing::ValuesIn(test_types)); |
| 3624 | 3618 |
| 3625 } // namespace test | 3619 } // namespace test |
| 3626 } // namespace ui | 3620 } // namespace ui |
| OLD | NEW |