OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 2850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2861 press.set_location_f(gfx::PointF(kX, kY)); | 2861 press.set_location_f(gfx::PointF(kX, kY)); |
2862 press.set_root_location_f(gfx::PointF(kX, kY)); | 2862 press.set_root_location_f(gfx::PointF(kX, kY)); |
2863 | 2863 |
2864 view_->OnTouchEvent(&press); | 2864 view_->OnTouchEvent(&press); |
2865 EXPECT_EQ(ui::MotionEvent::ACTION_DOWN, pointer_state().GetAction()); | 2865 EXPECT_EQ(ui::MotionEvent::ACTION_DOWN, pointer_state().GetAction()); |
2866 EXPECT_EQ(1U, pointer_state().GetPointerCount()); | 2866 EXPECT_EQ(1U, pointer_state().GetPointerCount()); |
2867 EXPECT_EQ(kX, pointer_state().GetX(0)); | 2867 EXPECT_EQ(kX, pointer_state().GetX(0)); |
2868 EXPECT_EQ(kY, pointer_state().GetY(0)); | 2868 EXPECT_EQ(kY, pointer_state().GetY(0)); |
2869 } | 2869 } |
2870 | 2870 |
| 2871 TEST_F(RenderWidgetHostViewAuraOverscrollTest, WheelNotPreciseScrollEvent) { |
| 2872 SetUpOverscrollEnvironment(); |
| 2873 |
| 2874 // Simulate wheel events. |
| 2875 SimulateWheelEvent(-5, 0, 0, false); // sent directly |
| 2876 SimulateWheelEvent(-60, 1, 0, false); // enqueued |
| 2877 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); |
| 2878 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 2879 |
| 2880 // Receive ACK the first wheel event as not processed. |
| 2881 SendInputEventACK(WebInputEvent::MouseWheel, |
| 2882 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 2883 |
| 2884 // ScrollBegin, ScrollUpdate, MouseWheel will be queued events |
| 2885 EXPECT_EQ(3U, GetSentMessageCountAndResetSink()); |
| 2886 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 2887 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 2888 |
| 2889 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); |
| 2890 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); |
| 2891 |
| 2892 SendInputEventACK(WebInputEvent::MouseWheel, |
| 2893 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 2894 // ScrollUpdate, MouseWheel will be queued events |
| 2895 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 2896 SendInputEventACK(WebInputEvent::GestureScrollUpdate, |
| 2897 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 2898 |
| 2899 EXPECT_EQ(OVERSCROLL_NONE, overscroll_mode()); |
| 2900 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); |
| 2901 } |
| 2902 |
2871 TEST_F(RenderWidgetHostViewAuraOverscrollTest, WheelScrollEventOverscrolls) { | 2903 TEST_F(RenderWidgetHostViewAuraOverscrollTest, WheelScrollEventOverscrolls) { |
2872 SetUpOverscrollEnvironment(); | 2904 SetUpOverscrollEnvironment(); |
2873 | 2905 |
2874 // Simulate wheel events. | 2906 // Simulate wheel events. |
2875 SimulateWheelEvent(-5, 0, 0, true); // sent directly | 2907 SimulateWheelEvent(-5, 0, 0, true); // sent directly |
2876 SimulateWheelEvent(-1, 1, 0, true); // enqueued | 2908 SimulateWheelEvent(-1, 1, 0, true); // enqueued |
2877 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event | 2909 SimulateWheelEvent(-10, -3, 0, true); // coalesced into previous event |
2878 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event | 2910 SimulateWheelEvent(-15, -1, 0, true); // coalesced into previous event |
2879 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event | 2911 SimulateWheelEvent(-30, -3, 0, true); // coalesced into previous event |
2880 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers | 2912 SimulateWheelEvent(-20, 6, 1, true); // enqueued, different modifiers |
(...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4643 | 4675 |
4644 // Retrieve the selected text from clipboard and verify it is as expected. | 4676 // Retrieve the selected text from clipboard and verify it is as expected. |
4645 base::string16 result_text; | 4677 base::string16 result_text; |
4646 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); | 4678 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); |
4647 EXPECT_EQ(expected_text, result_text); | 4679 EXPECT_EQ(expected_text, result_text); |
4648 } | 4680 } |
4649 } | 4681 } |
4650 #endif | 4682 #endif |
4651 | 4683 |
4652 } // namespace content | 4684 } // namespace content |
OLD | NEW |