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

Side by Side Diff: ui/events/blink/input_handler_proxy_unittest.cc

Issue 1802743002: Deflake input_handler_proxy_unittest.cc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/test/histogram_tester.h" 9 #include "base/test/histogram_tester.h"
10 #include "cc/input/main_thread_scrolling_reason.h" 10 #include "cc/input/main_thread_scrolling_reason.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } 380 }
381 381
382 void SetSmoothScrollEnabled(bool value) { 382 void SetSmoothScrollEnabled(bool value) {
383 input_handler_->smooth_scroll_enabled_ = value; 383 input_handler_->smooth_scroll_enabled_ = value;
384 } 384 }
385 385
386 void SetMouseWheelGesturesOn(bool value) { 386 void SetMouseWheelGesturesOn(bool value) {
387 input_handler_->set_use_gesture_events_for_mouse_wheel(value); 387 input_handler_->set_use_gesture_events_for_mouse_wheel(value);
388 } 388 }
389 389
390 base::HistogramTester& histogram_tester() {
391 return histogram_tester_;
392 }
393
390 protected: 394 protected:
391 const bool synchronous_root_scroll_; 395 const bool synchronous_root_scroll_;
392 const bool install_synchronous_handler_; 396 const bool install_synchronous_handler_;
393 testing::StrictMock<MockInputHandler> mock_input_handler_; 397 testing::StrictMock<MockInputHandler> mock_input_handler_;
394 testing::StrictMock<MockSynchronousInputHandler> 398 testing::StrictMock<MockSynchronousInputHandler>
395 mock_synchronous_input_handler_; 399 mock_synchronous_input_handler_;
396 scoped_ptr<TestInputHandlerProxy> input_handler_; 400 scoped_ptr<TestInputHandlerProxy> input_handler_;
397 testing::StrictMock<MockInputHandlerProxyClient> mock_client_; 401 testing::StrictMock<MockInputHandlerProxyClient> mock_client_;
398 WebGestureEvent gesture_; 402 WebGestureEvent gesture_;
399 InputHandlerProxy::EventDisposition expected_disposition_; 403 InputHandlerProxy::EventDisposition expected_disposition_;
404 base::HistogramTester histogram_tester_;
400 cc::InputHandlerScrollResult scroll_result_did_scroll_; 405 cc::InputHandlerScrollResult scroll_result_did_scroll_;
401 cc::InputHandlerScrollResult scroll_result_did_not_scroll_; 406 cc::InputHandlerScrollResult scroll_result_did_not_scroll_;
402 }; 407 };
403 408
404 TEST_P(InputHandlerProxyTest, MouseWheelByPageMainThread) { 409 TEST_P(InputHandlerProxyTest, MouseWheelByPageMainThread) {
405 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; 410 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
406 SetMouseWheelGesturesOn(false); 411 SetMouseWheelGesturesOn(false);
407 WebMouseWheelEvent wheel; 412 WebMouseWheelEvent wheel;
408 wheel.type = WebInputEvent::MouseWheel; 413 wheel.type = WebInputEvent::MouseWheel;
409 wheel.scrollByPage = true; 414 wheel.scrollByPage = true;
(...skipping 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after
2795 EXPECT_CALL(mock_input_handler, SetSynchronousInputHandlerRootScrollOffset( 2800 EXPECT_CALL(mock_input_handler, SetSynchronousInputHandlerRootScrollOffset(
2796 gfx::ScrollOffset(5, 6))); 2801 gfx::ScrollOffset(5, 6)));
2797 proxy.SynchronouslySetRootScrollOffset(gfx::ScrollOffset(5, 6)); 2802 proxy.SynchronouslySetRootScrollOffset(gfx::ScrollOffset(5, 6));
2798 2803
2799 testing::Mock::VerifyAndClearExpectations(&mock_input_handler); 2804 testing::Mock::VerifyAndClearExpectations(&mock_input_handler);
2800 testing::Mock::VerifyAndClearExpectations(&mock_client); 2805 testing::Mock::VerifyAndClearExpectations(&mock_client);
2801 testing::Mock::VerifyAndClearExpectations(&mock_synchronous_input_handler); 2806 testing::Mock::VerifyAndClearExpectations(&mock_synchronous_input_handler);
2802 } 2807 }
2803 2808
2804 TEST_P(InputHandlerProxyTest, MainThreadScrollingMouseWheelHistograms) { 2809 TEST_P(InputHandlerProxyTest, MainThreadScrollingMouseWheelHistograms) {
2805 base::HistogramTester histogram_tester;
2806 input_handler_->RecordMainThreadScrollingReasonsForTest( 2810 input_handler_->RecordMainThreadScrollingReasonsForTest(
2807 WebInputEvent::MouseWheel, 2811 WebInputEvent::MouseWheel,
2808 cc::MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects | 2812 cc::MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects |
2809 cc::MainThreadScrollingReason::kThreadedScrollingDisabled | 2813 cc::MainThreadScrollingReason::kThreadedScrollingDisabled |
2810 cc::MainThreadScrollingReason::kPageOverlay | 2814 cc::MainThreadScrollingReason::kPageOverlay |
2811 cc::MainThreadScrollingReason::kAnimatingScrollOnMainThread); 2815 cc::MainThreadScrollingReason::kAnimatingScrollOnMainThread);
2812 2816
2813 EXPECT_THAT( 2817 EXPECT_THAT(
2814 histogram_tester.GetAllSamples("Renderer4.MainThreadWheelScrollReason"), 2818 histogram_tester().GetAllSamples("Renderer4.MainThreadWheelScrollReason"),
2815 testing::ElementsAre(base::Bucket(1, 1), base::Bucket(3, 1), 2819 testing::ElementsAre(base::Bucket(1, 1), base::Bucket(3, 1),
2816 base::Bucket(5, 1), base::Bucket(14, 1))); 2820 base::Bucket(5, 1), base::Bucket(14, 1)));
2817 } 2821 }
2818 2822
2819 2823
2820 INSTANTIATE_TEST_CASE_P(AnimateInput, 2824 INSTANTIATE_TEST_CASE_P(AnimateInput,
2821 InputHandlerProxyTest, 2825 InputHandlerProxyTest,
2822 testing::ValuesIn(test_types)); 2826 testing::ValuesIn(test_types));
2823 } // namespace test 2827 } // namespace test
2824 } // namespace ui 2828 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698