| 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 3651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3662 | 3662 |
| 3663 // Simulates the mouse wheel event with ctrl modifier applied. | 3663 // Simulates the mouse wheel event with ctrl modifier applied. |
| 3664 ui::MouseWheelEvent event(gfx::Vector2d(1, 1), gfx::Point(), gfx::Point(), | 3664 ui::MouseWheelEvent event(gfx::Vector2d(1, 1), gfx::Point(), gfx::Point(), |
| 3665 ui::EventTimeForNow(), ui::EF_CONTROL_DOWN, 0); | 3665 ui::EventTimeForNow(), ui::EF_CONTROL_DOWN, 0); |
| 3666 view_->OnMouseEvent(&event); | 3666 view_->OnMouseEvent(&event); |
| 3667 | 3667 |
| 3668 const WebInputEvent* input_event = | 3668 const WebInputEvent* input_event = |
| 3669 GetInputEventFromMessage(*sink_->GetMessageAt(0)); | 3669 GetInputEventFromMessage(*sink_->GetMessageAt(0)); |
| 3670 const WebMouseWheelEvent* wheel_event = | 3670 const WebMouseWheelEvent* wheel_event = |
| 3671 static_cast<const WebMouseWheelEvent*>(input_event); | 3671 static_cast<const WebMouseWheelEvent*>(input_event); |
| 3672 // Check if the canScroll set to false when ctrl-scroll is generated from | 3672 // Check if scroll is caused when ctrl-scroll is generated from |
| 3673 // mouse wheel event. | 3673 // mouse wheel event. |
| 3674 EXPECT_FALSE(wheel_event->canScroll); | 3674 EXPECT_FALSE(WebInputEventTraits::CanCauseScroll(*wheel_event)); |
| 3675 sink_->ClearMessages(); | 3675 sink_->ClearMessages(); |
| 3676 | 3676 |
| 3677 // Ack'ing the outstanding event should flush the pending event queue. | 3677 // Ack'ing the outstanding event should flush the pending event queue. |
| 3678 SendInputEventACK(blink::WebInputEvent::MouseWheel, | 3678 SendInputEventACK(blink::WebInputEvent::MouseWheel, |
| 3679 INPUT_EVENT_ACK_STATE_CONSUMED); | 3679 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 3680 | 3680 |
| 3681 // Simulates the mouse wheel event with no modifier applied. | 3681 // Simulates the mouse wheel event with no modifier applied. |
| 3682 event = ui::MouseWheelEvent(gfx::Vector2d(1, 1), gfx::Point(), gfx::Point(), | 3682 event = ui::MouseWheelEvent(gfx::Vector2d(1, 1), gfx::Point(), gfx::Point(), |
| 3683 ui::EventTimeForNow(), ui::EF_NONE, 0); | 3683 ui::EventTimeForNow(), ui::EF_NONE, 0); |
| 3684 | 3684 |
| 3685 view_->OnMouseEvent(&event); | 3685 view_->OnMouseEvent(&event); |
| 3686 | 3686 |
| 3687 input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0)); | 3687 input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0)); |
| 3688 wheel_event = static_cast<const WebMouseWheelEvent*>(input_event); | 3688 wheel_event = static_cast<const WebMouseWheelEvent*>(input_event); |
| 3689 // Check if the canScroll set to true when no modifier is applied to the | 3689 // Check if scroll is caused when no modifier is applied to the |
| 3690 // mouse wheel event. | 3690 // mouse wheel event. |
| 3691 EXPECT_TRUE(wheel_event->canScroll); | 3691 EXPECT_TRUE(WebInputEventTraits::CanCauseScroll(*wheel_event)); |
| 3692 sink_->ClearMessages(); | 3692 sink_->ClearMessages(); |
| 3693 | 3693 |
| 3694 SendInputEventACK(blink::WebInputEvent::MouseWheel, | 3694 SendInputEventACK(blink::WebInputEvent::MouseWheel, |
| 3695 INPUT_EVENT_ACK_STATE_CONSUMED); | 3695 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 3696 | 3696 |
| 3697 // Simulates the scroll event with ctrl modifier applied. | 3697 // Simulates the scroll event with ctrl modifier applied. |
| 3698 ui::ScrollEvent scroll(ui::ET_SCROLL, gfx::Point(2, 2), ui::EventTimeForNow(), | 3698 ui::ScrollEvent scroll(ui::ET_SCROLL, gfx::Point(2, 2), ui::EventTimeForNow(), |
| 3699 ui::EF_CONTROL_DOWN, 0, 5, 0, 5, 2); | 3699 ui::EF_CONTROL_DOWN, 0, 5, 0, 5, 2); |
| 3700 view_->OnScrollEvent(&scroll); | 3700 view_->OnScrollEvent(&scroll); |
| 3701 | 3701 |
| 3702 input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0)); | 3702 input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0)); |
| 3703 wheel_event = static_cast<const WebMouseWheelEvent*>(input_event); | 3703 wheel_event = static_cast<const WebMouseWheelEvent*>(input_event); |
| 3704 // Check if the canScroll set to true when ctrl-touchpad-scroll is generated | 3704 // Check if scroll is caused when ctrl-touchpad-scroll is generated |
| 3705 // from scroll event. | 3705 // from scroll event. |
| 3706 EXPECT_TRUE(wheel_event->canScroll); | 3706 EXPECT_TRUE(WebInputEventTraits::CanCauseScroll(*wheel_event)); |
| 3707 } | 3707 } |
| 3708 | 3708 |
| 3709 // Ensures that the mapping from ui::TouchEvent to blink::WebTouchEvent doesn't | 3709 // Ensures that the mapping from ui::TouchEvent to blink::WebTouchEvent doesn't |
| 3710 // lose track of the number of acks required. | 3710 // lose track of the number of acks required. |
| 3711 TEST_F(RenderWidgetHostViewAuraTest, CorrectNumberOfAcksAreDispatched) { | 3711 TEST_F(RenderWidgetHostViewAuraTest, CorrectNumberOfAcksAreDispatched) { |
| 3712 view_->InitAsFullscreen(parent_view_); | 3712 view_->InitAsFullscreen(parent_view_); |
| 3713 view_->Show(); | 3713 view_->Show(); |
| 3714 view_->UseFakeDispatcher(); | 3714 view_->UseFakeDispatcher(); |
| 3715 | 3715 |
| 3716 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), 0, | 3716 ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), 0, |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3992 view()->OnGestureEvent(&gesture_event); | 3992 view()->OnGestureEvent(&gesture_event); |
| 3993 | 3993 |
| 3994 EXPECT_TRUE(delegate->context_menu_request_received()); | 3994 EXPECT_TRUE(delegate->context_menu_request_received()); |
| 3995 EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH); | 3995 EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH); |
| 3996 #endif | 3996 #endif |
| 3997 | 3997 |
| 3998 RenderViewHostFactory::set_is_real_render_view_host(false); | 3998 RenderViewHostFactory::set_is_real_render_view_host(false); |
| 3999 } | 3999 } |
| 4000 | 4000 |
| 4001 } // namespace content | 4001 } // namespace content |
| OLD | NEW |