| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 441 |
| 442 void SendInputEventACK(WebInputEvent::Type type, | 442 void SendInputEventACK(WebInputEvent::Type type, |
| 443 InputEventAckState ack_result) { | 443 InputEventAckState ack_result) { |
| 444 InputHostMsg_HandleInputEvent_ACK_Params ack; | 444 InputHostMsg_HandleInputEvent_ACK_Params ack; |
| 445 ack.type = type; | 445 ack.type = type; |
| 446 ack.state = ack_result; | 446 ack.state = ack_result; |
| 447 InputHostMsg_HandleInputEvent_ACK response(0, ack); | 447 InputHostMsg_HandleInputEvent_ACK response(0, ack); |
| 448 widget_host_->OnMessageReceived(response); | 448 widget_host_->OnMessageReceived(response); |
| 449 } | 449 } |
| 450 | 450 |
| 451 size_t GetSentMessageCountAndResetSink() { |
| 452 size_t count = sink_->message_count(); |
| 453 sink_->ClearMessages(); |
| 454 return count; |
| 455 } |
| 456 |
| 457 void AckLastSentInputEventIfNecessary(InputEventAckState ack_result) { |
| 458 if (!sink_->message_count()) |
| 459 return; |
| 460 |
| 461 InputMsg_HandleInputEvent::Param params; |
| 462 if (!InputMsg_HandleInputEvent::Read( |
| 463 sink_->GetMessageAt(sink_->message_count() - 1), ¶ms)) { |
| 464 return; |
| 465 } |
| 466 |
| 467 if (WebInputEventTraits::IgnoresAckDisposition(*get<0>(params))) |
| 468 return; |
| 469 |
| 470 SendInputEventACK(get<0>(params)->type, ack_result); |
| 471 } |
| 472 |
| 451 protected: | 473 protected: |
| 452 // If true, then calls RWH::Shutdown() instead of deleting RWH. | 474 // If true, then calls RWH::Shutdown() instead of deleting RWH. |
| 453 bool widget_host_uses_shutdown_to_destroy_; | 475 bool widget_host_uses_shutdown_to_destroy_; |
| 454 | 476 |
| 455 bool is_guest_view_hack_; | 477 bool is_guest_view_hack_; |
| 456 | 478 |
| 457 base::MessageLoopForUI message_loop_; | 479 base::MessageLoopForUI message_loop_; |
| 458 BrowserThreadImpl browser_thread_for_ui_; | 480 BrowserThreadImpl browser_thread_for_ui_; |
| 459 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; | 481 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; |
| 460 scoped_ptr<BrowserContext> browser_context_; | 482 scoped_ptr<BrowserContext> browser_context_; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 void MoveTouchPoint(int index, int x, int y) { | 708 void MoveTouchPoint(int index, int x, int y) { |
| 687 touch_event_.MovePoint(index, x, y); | 709 touch_event_.MovePoint(index, x, y); |
| 688 SendTouchEvent(); | 710 SendTouchEvent(); |
| 689 } | 711 } |
| 690 | 712 |
| 691 void ReleaseTouchPoint(int index) { | 713 void ReleaseTouchPoint(int index) { |
| 692 touch_event_.ReleasePoint(index); | 714 touch_event_.ReleasePoint(index); |
| 693 SendTouchEvent(); | 715 SendTouchEvent(); |
| 694 } | 716 } |
| 695 | 717 |
| 696 size_t GetSentMessageCountAndResetSink() { | |
| 697 size_t count = sink_->message_count(); | |
| 698 sink_->ClearMessages(); | |
| 699 return count; | |
| 700 } | |
| 701 | |
| 702 void AckLastSentInputEventIfNecessary(InputEventAckState ack_result) { | |
| 703 if (!sink_->message_count()) | |
| 704 return; | |
| 705 | |
| 706 InputMsg_HandleInputEvent::Param params; | |
| 707 if (!InputMsg_HandleInputEvent::Read( | |
| 708 sink_->GetMessageAt(sink_->message_count() - 1), ¶ms)) { | |
| 709 return; | |
| 710 } | |
| 711 | |
| 712 if (WebInputEventTraits::IgnoresAckDisposition(*get<0>(params))) | |
| 713 return; | |
| 714 | |
| 715 SendInputEventACK(get<0>(params)->type, ack_result); | |
| 716 } | |
| 717 | |
| 718 SyntheticWebTouchEvent touch_event_; | 718 SyntheticWebTouchEvent touch_event_; |
| 719 | 719 |
| 720 scoped_ptr<TestOverscrollDelegate> overscroll_delegate_; | 720 scoped_ptr<TestOverscrollDelegate> overscroll_delegate_; |
| 721 | 721 |
| 722 private: | 722 private: |
| 723 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAuraOverscrollTest); | 723 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAuraOverscrollTest); |
| 724 }; | 724 }; |
| 725 | 725 |
| 726 class RenderWidgetHostViewAuraShutdownTest | 726 class RenderWidgetHostViewAuraShutdownTest |
| 727 : public RenderWidgetHostViewAuraTest { | 727 : public RenderWidgetHostViewAuraTest { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 sink_->GetMessageAt(0)->type()); | 1014 sink_->GetMessageAt(0)->type()); |
| 1015 EXPECT_EQ(InputMsg_HandleInputEvent::ID, | 1015 EXPECT_EQ(InputMsg_HandleInputEvent::ID, |
| 1016 sink_->GetMessageAt(1)->type()); | 1016 sink_->GetMessageAt(1)->type()); |
| 1017 } | 1017 } |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 // Checks that touch-event state is maintained correctly. | 1020 // Checks that touch-event state is maintained correctly. |
| 1021 TEST_F(RenderWidgetHostViewAuraTest, TouchEventState) { | 1021 TEST_F(RenderWidgetHostViewAuraTest, TouchEventState) { |
| 1022 view_->InitAsChild(NULL); | 1022 view_->InitAsChild(NULL); |
| 1023 view_->Show(); | 1023 view_->Show(); |
| 1024 GetSentMessageCountAndResetSink(); |
| 1024 | 1025 |
| 1025 // Start with no touch-event handler in the renderer. | 1026 // Start with no touch-event handler in the renderer. |
| 1026 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, false)); | 1027 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, false)); |
| 1027 EXPECT_FALSE(widget_host_->ShouldForwardTouchEvent()); | |
| 1028 | 1028 |
| 1029 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, | 1029 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, |
| 1030 gfx::Point(30, 30), | 1030 gfx::Point(30, 30), |
| 1031 0, | 1031 0, |
| 1032 ui::EventTimeForNow()); | 1032 ui::EventTimeForNow()); |
| 1033 ui::TouchEvent move(ui::ET_TOUCH_MOVED, | 1033 ui::TouchEvent move(ui::ET_TOUCH_MOVED, |
| 1034 gfx::Point(20, 20), | 1034 gfx::Point(20, 20), |
| 1035 0, | 1035 0, |
| 1036 ui::EventTimeForNow()); | 1036 ui::EventTimeForNow()); |
| 1037 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, | 1037 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, |
| 1038 gfx::Point(20, 20), | 1038 gfx::Point(20, 20), |
| 1039 0, | 1039 0, |
| 1040 ui::EventTimeForNow()); | 1040 ui::EventTimeForNow()); |
| 1041 | 1041 |
| 1042 // The touch events should get forwared from the view, but they should not |
| 1043 // reach the renderer. |
| 1042 view_->OnTouchEvent(&press); | 1044 view_->OnTouchEvent(&press); |
| 1043 EXPECT_FALSE(press.handled()); | 1045 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
| 1046 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1044 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_->type); | 1047 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_->type); |
| 1045 EXPECT_TRUE(view_->touch_event_->cancelable); | 1048 EXPECT_TRUE(view_->touch_event_->cancelable); |
| 1046 EXPECT_EQ(1U, view_->touch_event_->touchesLength); | 1049 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 1047 EXPECT_EQ(blink::WebTouchPoint::StatePressed, | 1050 EXPECT_EQ(blink::WebTouchPoint::StatePressed, |
| 1048 view_->touch_event_->touches[0].state); | 1051 view_->touch_event_->touches[0].state); |
| 1049 | 1052 |
| 1050 view_->OnTouchEvent(&move); | 1053 view_->OnTouchEvent(&move); |
| 1051 EXPECT_FALSE(move.handled()); | 1054 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
| 1055 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1052 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_->type); | 1056 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_->type); |
| 1053 EXPECT_TRUE(view_->touch_event_->cancelable); | 1057 EXPECT_TRUE(view_->touch_event_->cancelable); |
| 1054 EXPECT_EQ(1U, view_->touch_event_->touchesLength); | 1058 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 1055 EXPECT_EQ(blink::WebTouchPoint::StateMoved, | 1059 EXPECT_EQ(blink::WebTouchPoint::StateMoved, |
| 1056 view_->touch_event_->touches[0].state); | 1060 view_->touch_event_->touches[0].state); |
| 1057 | 1061 |
| 1058 view_->OnTouchEvent(&release); | 1062 view_->OnTouchEvent(&release); |
| 1059 EXPECT_FALSE(release.handled()); | 1063 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
| 1064 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1060 EXPECT_EQ(nullptr, view_->touch_event_); | 1065 EXPECT_EQ(nullptr, view_->touch_event_); |
| 1061 | 1066 |
| 1062 // Now install some touch-event handlers and do the same steps. The touch | 1067 // Now install some touch-event handlers and do the same steps. The touch |
| 1063 // events should now be consumed. However, the touch-event state should be | 1068 // events should now be consumed. However, the touch-event state should be |
| 1064 // updated as before. | 1069 // updated as before. |
| 1065 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); | 1070 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); |
| 1066 EXPECT_TRUE(widget_host_->ShouldForwardTouchEvent()); | |
| 1067 | 1071 |
| 1068 view_->OnTouchEvent(&press); | 1072 view_->OnTouchEvent(&press); |
| 1073 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 1069 EXPECT_TRUE(press.synchronous_handling_disabled()); | 1074 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1070 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_->type); | 1075 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_->type); |
| 1071 EXPECT_TRUE(view_->touch_event_->cancelable); | 1076 EXPECT_TRUE(view_->touch_event_->cancelable); |
| 1072 EXPECT_EQ(1U, view_->touch_event_->touchesLength); | 1077 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 1073 EXPECT_EQ(blink::WebTouchPoint::StatePressed, | 1078 EXPECT_EQ(blink::WebTouchPoint::StatePressed, |
| 1074 view_->touch_event_->touches[0].state); | 1079 view_->touch_event_->touches[0].state); |
| 1075 | 1080 |
| 1076 view_->OnTouchEvent(&move); | 1081 view_->OnTouchEvent(&move); |
| 1077 EXPECT_TRUE(move.synchronous_handling_disabled()); | 1082 EXPECT_TRUE(move.synchronous_handling_disabled()); |
| 1078 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_->type); | 1083 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_->type); |
| 1079 EXPECT_TRUE(view_->touch_event_->cancelable); | 1084 EXPECT_TRUE(view_->touch_event_->cancelable); |
| 1080 EXPECT_EQ(1U, view_->touch_event_->touchesLength); | 1085 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 1081 EXPECT_EQ(blink::WebTouchPoint::StateMoved, | 1086 EXPECT_EQ(blink::WebTouchPoint::StateMoved, |
| 1082 view_->touch_event_->touches[0].state); | 1087 view_->touch_event_->touches[0].state); |
| 1083 view_->OnTouchEvent(&release); | 1088 view_->OnTouchEvent(&release); |
| 1084 EXPECT_TRUE(release.synchronous_handling_disabled()); | 1089 EXPECT_TRUE(release.synchronous_handling_disabled()); |
| 1085 EXPECT_EQ(nullptr, view_->touch_event_); | 1090 EXPECT_EQ(nullptr, view_->touch_event_); |
| 1086 | 1091 |
| 1087 // Now start a touch event, and remove the event-handlers before the release. | 1092 // Now start a touch event, and remove the event-handlers before the release. |
| 1088 view_->OnTouchEvent(&press); | 1093 view_->OnTouchEvent(&press); |
| 1089 EXPECT_TRUE(press.synchronous_handling_disabled()); | 1094 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1090 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_->type); | 1095 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_->type); |
| 1091 EXPECT_EQ(1U, view_->touch_event_->touchesLength); | 1096 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 1092 EXPECT_EQ(blink::WebTouchPoint::StatePressed, | 1097 EXPECT_EQ(blink::WebTouchPoint::StatePressed, |
| 1093 view_->touch_event_->touches[0].state); | 1098 view_->touch_event_->touches[0].state); |
| 1094 | 1099 |
| 1095 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, false)); | 1100 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, false)); |
| 1096 EXPECT_TRUE(widget_host_->ShouldForwardTouchEvent()); | |
| 1097 | 1101 |
| 1098 // Ack'ing the outstanding event should flush the pending touch queue. | 1102 // Ack'ing the outstanding event should flush the pending touch queue. |
| 1099 InputHostMsg_HandleInputEvent_ACK_Params ack; | 1103 InputHostMsg_HandleInputEvent_ACK_Params ack; |
| 1100 ack.type = blink::WebInputEvent::TouchStart; | 1104 ack.type = blink::WebInputEvent::TouchStart; |
| 1101 ack.state = INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | 1105 ack.state = INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
| 1102 widget_host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); | 1106 widget_host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); |
| 1103 EXPECT_FALSE(widget_host_->ShouldForwardTouchEvent()); | 1107 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
| 1104 | 1108 |
| 1105 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0, | 1109 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0, |
| 1106 base::Time::NowFromSystemTime() - base::Time()); | 1110 base::Time::NowFromSystemTime() - base::Time()); |
| 1107 view_->OnTouchEvent(&move2); | 1111 view_->OnTouchEvent(&move2); |
| 1108 EXPECT_FALSE(move2.handled()); | 1112 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1109 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_->type); | 1113 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_->type); |
| 1110 EXPECT_EQ(1U, view_->touch_event_->touchesLength); | 1114 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 1111 EXPECT_EQ(blink::WebTouchPoint::StateMoved, | 1115 EXPECT_EQ(blink::WebTouchPoint::StateMoved, |
| 1112 view_->touch_event_->touches[0].state); | 1116 view_->touch_event_->touches[0].state); |
| 1113 | 1117 |
| 1114 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 0, | 1118 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 0, |
| 1115 base::Time::NowFromSystemTime() - base::Time()); | 1119 base::Time::NowFromSystemTime() - base::Time()); |
| 1116 view_->OnTouchEvent(&release2); | 1120 view_->OnTouchEvent(&release2); |
| 1117 EXPECT_FALSE(release2.handled()); | 1121 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1118 EXPECT_EQ(nullptr, view_->touch_event_); | 1122 EXPECT_EQ(nullptr, view_->touch_event_); |
| 1119 } | 1123 } |
| 1120 | 1124 |
| 1121 // Checks that touch-events are queued properly when there is a touch-event | 1125 // Checks that touch-events are queued properly when there is a touch-event |
| 1122 // handler on the page. | 1126 // handler on the page. |
| 1123 TEST_F(RenderWidgetHostViewAuraTest, TouchEventSyncAsync) { | 1127 TEST_F(RenderWidgetHostViewAuraTest, TouchEventSyncAsync) { |
| 1124 view_->InitAsChild(NULL); | 1128 view_->InitAsChild(NULL); |
| 1125 view_->Show(); | 1129 view_->Show(); |
| 1126 | 1130 |
| 1127 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); | 1131 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); |
| 1128 EXPECT_TRUE(widget_host_->ShouldForwardTouchEvent()); | |
| 1129 | 1132 |
| 1130 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, | 1133 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, |
| 1131 gfx::Point(30, 30), | 1134 gfx::Point(30, 30), |
| 1132 0, | 1135 0, |
| 1133 ui::EventTimeForNow()); | 1136 ui::EventTimeForNow()); |
| 1134 ui::TouchEvent move(ui::ET_TOUCH_MOVED, | 1137 ui::TouchEvent move(ui::ET_TOUCH_MOVED, |
| 1135 gfx::Point(20, 20), | 1138 gfx::Point(20, 20), |
| 1136 0, | 1139 0, |
| 1137 ui::EventTimeForNow()); | 1140 ui::EventTimeForNow()); |
| 1138 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, | 1141 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, |
| (...skipping 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3095 TearDownEnvironment(); | 3098 TearDownEnvironment(); |
| 3096 ASSERT_FALSE(guest_view_weak_.get()); | 3099 ASSERT_FALSE(guest_view_weak_.get()); |
| 3097 } | 3100 } |
| 3098 | 3101 |
| 3099 // Tests that invalid touch events are consumed and handled | 3102 // Tests that invalid touch events are consumed and handled |
| 3100 // synchronously. | 3103 // synchronously. |
| 3101 TEST_F(RenderWidgetHostViewAuraTest, | 3104 TEST_F(RenderWidgetHostViewAuraTest, |
| 3102 InvalidEventsHaveSyncHandlingDisabled) { | 3105 InvalidEventsHaveSyncHandlingDisabled) { |
| 3103 view_->InitAsChild(NULL); | 3106 view_->InitAsChild(NULL); |
| 3104 view_->Show(); | 3107 view_->Show(); |
| 3108 GetSentMessageCountAndResetSink(); |
| 3105 | 3109 |
| 3106 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); | 3110 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); |
| 3107 EXPECT_TRUE(widget_host_->ShouldForwardTouchEvent()); | |
| 3108 | 3111 |
| 3109 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), 0, | 3112 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(30, 30), 0, |
| 3110 ui::EventTimeForNow()); | 3113 ui::EventTimeForNow()); |
| 3111 | 3114 |
| 3112 // Construct a move with a touch id which doesn't exist. | 3115 // Construct a move with a touch id which doesn't exist. |
| 3113 ui::TouchEvent invalid_move(ui::ET_TOUCH_MOVED, gfx::Point(30, 30), 1, | 3116 ui::TouchEvent invalid_move(ui::ET_TOUCH_MOVED, gfx::Point(30, 30), 1, |
| 3114 ui::EventTimeForNow()); | 3117 ui::EventTimeForNow()); |
| 3115 | 3118 |
| 3119 // Valid press is handled asynchronously. |
| 3116 view_->OnTouchEvent(&press); | 3120 view_->OnTouchEvent(&press); |
| 3121 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 3122 EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
| 3123 AckLastSentInputEventIfNecessary(INPUT_EVENT_ACK_STATE_CONSUMED); |
| 3124 |
| 3125 // Invalid move is handled synchronously, but is consumed. It should not |
| 3126 // be forwarded to the renderer. |
| 3117 view_->OnTouchEvent(&invalid_move); | 3127 view_->OnTouchEvent(&invalid_move); |
| 3118 // Valid press is handled asynchronously. | 3128 EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
| 3119 EXPECT_TRUE(press.synchronous_handling_disabled()); | |
| 3120 // Invalid move is handled synchronously, but is consumed. | |
| 3121 EXPECT_FALSE(invalid_move.synchronous_handling_disabled()); | 3129 EXPECT_FALSE(invalid_move.synchronous_handling_disabled()); |
| 3122 EXPECT_TRUE(invalid_move.stopped_propagation()); | 3130 EXPECT_TRUE(invalid_move.stopped_propagation()); |
| 3123 } | 3131 } |
| 3124 | 3132 |
| 3125 // Checks key event codes. | 3133 // Checks key event codes. |
| 3126 TEST_F(RenderWidgetHostViewAuraTest, KeyEvent) { | 3134 TEST_F(RenderWidgetHostViewAuraTest, KeyEvent) { |
| 3127 view_->InitAsChild(NULL); | 3135 view_->InitAsChild(NULL); |
| 3128 view_->Show(); | 3136 view_->Show(); |
| 3129 | 3137 |
| 3130 ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::DomCode::KEY_A, | 3138 ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::DomCode::KEY_A, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3209 ui::TouchEvent press2( | 3217 ui::TouchEvent press2( |
| 3210 ui::ET_TOUCH_PRESSED, gfx::Point(20, 20), 1, ui::EventTimeForNow()); | 3218 ui::ET_TOUCH_PRESSED, gfx::Point(20, 20), 1, ui::EventTimeForNow()); |
| 3211 view_->OnTouchEvent(&press2); | 3219 view_->OnTouchEvent(&press2); |
| 3212 SendInputEventACK(blink::WebInputEvent::TouchStart, | 3220 SendInputEventACK(blink::WebInputEvent::TouchStart, |
| 3213 INPUT_EVENT_ACK_STATE_CONSUMED); | 3221 INPUT_EVENT_ACK_STATE_CONSUMED); |
| 3214 | 3222 |
| 3215 EXPECT_EQ(2U, view_->dispatcher_->processed_touch_event_count()); | 3223 EXPECT_EQ(2U, view_->dispatcher_->processed_touch_event_count()); |
| 3216 } | 3224 } |
| 3217 | 3225 |
| 3218 } // namespace content | 3226 } // namespace content |
| OLD | NEW |