| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 | 10 |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 | 959 |
| 960 // Forward the Char event. | 960 // Forward the Char event. |
| 961 SimulateKeyboardEvent(WebInputEvent::Char); | 961 SimulateKeyboardEvent(WebInputEvent::Char); |
| 962 | 962 |
| 963 // Make sure the Char event is suppressed. | 963 // Make sure the Char event is suppressed. |
| 964 EXPECT_EQ(0U, process_->sink().message_count()); | 964 EXPECT_EQ(0U, process_->sink().message_count()); |
| 965 | 965 |
| 966 // Forward the KeyUp event. | 966 // Forward the KeyUp event. |
| 967 SimulateKeyboardEvent(WebInputEvent::KeyUp); | 967 SimulateKeyboardEvent(WebInputEvent::KeyUp); |
| 968 | 968 |
| 969 // Make sure only KeyUp was sent to the renderer. | 969 // Make sure the KeyUp event is suppressed. |
| 970 EXPECT_EQ(0U, process_->sink().message_count()); |
| 971 |
| 972 // Simulate a new RawKeyDown event. |
| 973 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); |
| 970 EXPECT_EQ(1U, process_->sink().message_count()); | 974 EXPECT_EQ(1U, process_->sink().message_count()); |
| 971 EXPECT_EQ(InputMsg_HandleInputEvent::ID, | 975 EXPECT_EQ(InputMsg_HandleInputEvent::ID, |
| 972 process_->sink().GetMessageAt(0)->type()); | 976 process_->sink().GetMessageAt(0)->type()); |
| 973 process_->sink().ClearMessages(); | 977 process_->sink().ClearMessages(); |
| 974 | 978 |
| 975 // Send the simulated response from the renderer back. | 979 // Send the simulated response from the renderer back. |
| 976 SendInputEventACK(WebInputEvent::KeyUp, | 980 SendInputEventACK(WebInputEvent::RawKeyDown, |
| 977 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); | 981 INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
| 978 | 982 |
| 979 EXPECT_TRUE(delegate_->unhandled_keyboard_event_called()); | 983 EXPECT_TRUE(delegate_->unhandled_keyboard_event_called()); |
| 980 EXPECT_EQ(WebInputEvent::KeyUp, delegate_->unhandled_keyboard_event_type()); | 984 EXPECT_EQ(WebInputEvent::RawKeyDown, |
| 985 delegate_->unhandled_keyboard_event_type()); |
| 981 } | 986 } |
| 982 | 987 |
| 983 TEST_F(RenderWidgetHostTest, RawKeyDownShortcutEvent) { | 988 TEST_F(RenderWidgetHostTest, RawKeyDownShortcutEvent) { |
| 984 // Simulate the situation that the browser marks the key down as a keyboard | 989 // Simulate the situation that the browser marks the key down as a keyboard |
| 985 // shortcut, but doesn't consume it in the pre-handle phase. | 990 // shortcut, but doesn't consume it in the pre-handle phase. |
| 986 delegate_->set_prehandle_keyboard_event_is_shortcut(true); | 991 delegate_->set_prehandle_keyboard_event_is_shortcut(true); |
| 987 process_->sink().ClearMessages(); | 992 process_->sink().ClearMessages(); |
| 988 | 993 |
| 989 // Simulate a keyboard event. | 994 // Simulate a keyboard event. |
| 990 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); | 995 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 ui::LatencyInfo()); | 1713 ui::LatencyInfo()); |
| 1709 | 1714 |
| 1710 | 1715 |
| 1711 // Tests RWHI::ForwardWheelEventWithLatencyInfo(). | 1716 // Tests RWHI::ForwardWheelEventWithLatencyInfo(). |
| 1712 SimulateWheelEventWithLatencyInfo(-5, 0, 0, true, ui::LatencyInfo()); | 1717 SimulateWheelEventWithLatencyInfo(-5, 0, 0, true, ui::LatencyInfo()); |
| 1713 | 1718 |
| 1714 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); | 1719 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); |
| 1715 } | 1720 } |
| 1716 | 1721 |
| 1717 } // namespace content | 1722 } // namespace content |
| OLD | NEW |