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

Unified Diff: content/browser/renderer_host/input/input_router_impl_unittest.cc

Issue 1391843006: Embed keyboard shortcut bit in WebKeyboardEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mac test compile Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/input_router_impl_unittest.cc
diff --git a/content/browser/renderer_host/input/input_router_impl_unittest.cc b/content/browser/renderer_host/input/input_router_impl_unittest.cc
index 034eb5ba27b2b3331739dd2c0ff9348903f5fa92..203fe99e8a51095b573f9cfa3add600e47a4a587 100644
--- a/content/browser/renderer_host/input/input_router_impl_unittest.cc
+++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc
@@ -80,12 +80,6 @@ WebInputEvent& GetEventWithType(WebInputEvent::Type type) {
return *event;
}
-bool GetIsShortcutFromHandleInputEventMessage(const IPC::Message* msg) {
- InputMsg_HandleInputEvent::Schema::Param param;
- InputMsg_HandleInputEvent::Read(msg, &param);
- return base::get<2>(param);
-}
-
template<typename MSG_T, typename ARG_T1>
void ExpectIPCMessageWithArg1(const IPC::Message* msg, const ARG_T1& arg1) {
ASSERT_EQ(MSG_T::ID, msg->type());
@@ -182,12 +176,12 @@ class InputRouterImplTest : public testing::Test {
input_router()->NotifySiteIsMobileOptimized(false);
}
- void SimulateKeyboardEvent(WebInputEvent::Type type, bool is_shortcut) {
+ void SimulateKeyboardEvent(WebInputEvent::Type type) {
WebKeyboardEvent event = SyntheticWebKeyboardEventBuilder::Build(type);
NativeWebKeyboardEvent native_event;
memcpy(&native_event, &event, sizeof(event));
NativeWebKeyboardEventWithLatencyInfo key_event(native_event);
- input_router_->SendKeyboardEvent(key_event, is_shortcut);
+ input_router_->SendKeyboardEvent(key_event);
}
void SimulateWheelEvent(float dX, float dY, int modifiers, bool precise) {
@@ -617,7 +611,7 @@ TEST_F(InputRouterImplTest, HandledInputEvent) {
client_->set_filter_state(INPUT_EVENT_ACK_STATE_CONSUMED);
// Simulate a keyboard event.
- SimulateKeyboardEvent(WebInputEvent::RawKeyDown, false);
+ SimulateKeyboardEvent(WebInputEvent::RawKeyDown);
// Make sure no input event is sent to the renderer.
EXPECT_EQ(0u, GetSentMessageCountAndResetSink());
@@ -634,7 +628,7 @@ TEST_F(InputRouterImplTest, ClientCanceledKeyboardEvent) {
client_->set_filter_state(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS);
// Simulate a keyboard event that has no consumer.
- SimulateKeyboardEvent(WebInputEvent::RawKeyDown, false);
+ SimulateKeyboardEvent(WebInputEvent::RawKeyDown);
// Make sure no input event is sent to the renderer.
EXPECT_EQ(0u, GetSentMessageCountAndResetSink());
@@ -643,27 +637,15 @@ TEST_F(InputRouterImplTest, ClientCanceledKeyboardEvent) {
// Simulate a keyboard event that should be dropped.
client_->set_filter_state(INPUT_EVENT_ACK_STATE_UNKNOWN);
- SimulateKeyboardEvent(WebInputEvent::RawKeyDown, false);
+ SimulateKeyboardEvent(WebInputEvent::RawKeyDown);
// Make sure no input event is sent to the renderer, and no ack is sent.
EXPECT_EQ(0u, GetSentMessageCountAndResetSink());
EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount());
}
-TEST_F(InputRouterImplTest, ShortcutKeyboardEvent) {
- SimulateKeyboardEvent(WebInputEvent::RawKeyDown, true);
- EXPECT_TRUE(GetIsShortcutFromHandleInputEventMessage(
- process_->sink().GetMessageAt(0)));
-
- process_->sink().ClearMessages();
-
- SimulateKeyboardEvent(WebInputEvent::RawKeyDown, false);
- EXPECT_FALSE(GetIsShortcutFromHandleInputEventMessage(
- process_->sink().GetMessageAt(0)));
-}
-
TEST_F(InputRouterImplTest, NoncorrespondingKeyEvents) {
- SimulateKeyboardEvent(WebInputEvent::RawKeyDown, false);
+ SimulateKeyboardEvent(WebInputEvent::RawKeyDown);
SendInputEventACK(WebInputEvent::KeyUp,
INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
@@ -674,7 +656,7 @@ TEST_F(InputRouterImplTest, NoncorrespondingKeyEvents) {
TEST_F(InputRouterImplTest, HandleKeyEventsWeSent) {
// Simulate a keyboard event.
- SimulateKeyboardEvent(WebInputEvent::RawKeyDown, false);
+ SimulateKeyboardEvent(WebInputEvent::RawKeyDown);
ASSERT_TRUE(input_router_->GetLastKeyboardEvent());
EXPECT_EQ(WebInputEvent::RawKeyDown,
input_router_->GetLastKeyboardEvent()->type);

Powered by Google App Engine
This is Rietveld 408576698