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> |
| 8 |
7 #include "base/macros.h" | 9 #include "base/macros.h" |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "base/test/histogram_tester.h" | 10 #include "base/test/histogram_tester.h" |
10 #include "cc/input/main_thread_scrolling_reason.h" | 11 #include "cc/input/main_thread_scrolling_reason.h" |
11 #include "cc/trees/swap_promise_monitor.h" | 12 #include "cc/trees/swap_promise_monitor.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 15 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
15 #include "third_party/WebKit/public/platform/WebFloatSize.h" | 16 #include "third_party/WebKit/public/platform/WebFloatSize.h" |
16 #include "third_party/WebKit/public/platform/WebGestureCurve.h" | 17 #include "third_party/WebKit/public/platform/WebGestureCurve.h" |
17 #include "third_party/WebKit/public/platform/WebPoint.h" | 18 #include "third_party/WebKit/public/platform/WebPoint.h" |
18 #include "third_party/WebKit/public/web/WebInputEvent.h" | 19 #include "third_party/WebKit/public/web/WebInputEvent.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 MOCK_METHOD2(ScrollAnimated, | 111 MOCK_METHOD2(ScrollAnimated, |
111 ScrollStatus(const gfx::Point& viewport_point, | 112 ScrollStatus(const gfx::Point& viewport_point, |
112 const gfx::Vector2dF& scroll_delta)); | 113 const gfx::Vector2dF& scroll_delta)); |
113 MOCK_METHOD1(ScrollBy, cc::InputHandlerScrollResult(cc::ScrollState*)); | 114 MOCK_METHOD1(ScrollBy, cc::InputHandlerScrollResult(cc::ScrollState*)); |
114 MOCK_METHOD2(ScrollVerticallyByPage, | 115 MOCK_METHOD2(ScrollVerticallyByPage, |
115 bool(const gfx::Point& viewport_point, | 116 bool(const gfx::Point& viewport_point, |
116 cc::ScrollDirection direction)); | 117 cc::ScrollDirection direction)); |
117 MOCK_METHOD1(ScrollEnd, void(cc::ScrollState*)); | 118 MOCK_METHOD1(ScrollEnd, void(cc::ScrollState*)); |
118 MOCK_METHOD0(FlingScrollBegin, cc::InputHandler::ScrollStatus()); | 119 MOCK_METHOD0(FlingScrollBegin, cc::InputHandler::ScrollStatus()); |
119 | 120 |
120 scoped_ptr<cc::SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( | 121 std::unique_ptr<cc::SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( |
121 ui::LatencyInfo* latency) override { | 122 ui::LatencyInfo* latency) override { |
122 return scoped_ptr<cc::SwapPromiseMonitor>(); | 123 return std::unique_ptr<cc::SwapPromiseMonitor>(); |
123 } | 124 } |
124 | 125 |
125 cc::ScrollElasticityHelper* CreateScrollElasticityHelper() override { | 126 cc::ScrollElasticityHelper* CreateScrollElasticityHelper() override { |
126 return NULL; | 127 return NULL; |
127 } | 128 } |
128 | 129 |
129 void BindToClient(cc::InputHandlerClient* client) override {} | 130 void BindToClient(cc::InputHandlerClient* client) override {} |
130 | 131 |
131 void MouseMoveAt(const gfx::Point& mouse_position) override {} | 132 void MouseMoveAt(const gfx::Point& mouse_position) override {} |
132 | 133 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 base::HistogramTester& histogram_tester() { | 391 base::HistogramTester& histogram_tester() { |
391 return histogram_tester_; | 392 return histogram_tester_; |
392 } | 393 } |
393 | 394 |
394 protected: | 395 protected: |
395 const bool synchronous_root_scroll_; | 396 const bool synchronous_root_scroll_; |
396 const bool install_synchronous_handler_; | 397 const bool install_synchronous_handler_; |
397 testing::StrictMock<MockInputHandler> mock_input_handler_; | 398 testing::StrictMock<MockInputHandler> mock_input_handler_; |
398 testing::StrictMock<MockSynchronousInputHandler> | 399 testing::StrictMock<MockSynchronousInputHandler> |
399 mock_synchronous_input_handler_; | 400 mock_synchronous_input_handler_; |
400 scoped_ptr<TestInputHandlerProxy> input_handler_; | 401 std::unique_ptr<TestInputHandlerProxy> input_handler_; |
401 testing::StrictMock<MockInputHandlerProxyClient> mock_client_; | 402 testing::StrictMock<MockInputHandlerProxyClient> mock_client_; |
402 WebGestureEvent gesture_; | 403 WebGestureEvent gesture_; |
403 InputHandlerProxy::EventDisposition expected_disposition_; | 404 InputHandlerProxy::EventDisposition expected_disposition_; |
404 base::HistogramTester histogram_tester_; | 405 base::HistogramTester histogram_tester_; |
405 cc::InputHandlerScrollResult scroll_result_did_scroll_; | 406 cc::InputHandlerScrollResult scroll_result_did_scroll_; |
406 cc::InputHandlerScrollResult scroll_result_did_not_scroll_; | 407 cc::InputHandlerScrollResult scroll_result_did_not_scroll_; |
407 }; | 408 }; |
408 | 409 |
409 TEST_P(InputHandlerProxyTest, MouseWheelByPageMainThread) { | 410 TEST_P(InputHandlerProxyTest, MouseWheelByPageMainThread) { |
410 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; | 411 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; |
(...skipping 2408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2819 testing::ElementsAre(base::Bucket(1, 1), base::Bucket(3, 1), | 2820 testing::ElementsAre(base::Bucket(1, 1), base::Bucket(3, 1), |
2820 base::Bucket(5, 1), base::Bucket(14, 1))); | 2821 base::Bucket(5, 1), base::Bucket(14, 1))); |
2821 } | 2822 } |
2822 | 2823 |
2823 | 2824 |
2824 INSTANTIATE_TEST_CASE_P(AnimateInput, | 2825 INSTANTIATE_TEST_CASE_P(AnimateInput, |
2825 InputHandlerProxyTest, | 2826 InputHandlerProxyTest, |
2826 testing::ValuesIn(test_types)); | 2827 testing::ValuesIn(test_types)); |
2827 } // namespace test | 2828 } // namespace test |
2828 } // namespace ui | 2829 } // namespace ui |
OLD | NEW |