| 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" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "cc/output/compositor_frame.h" | 13 #include "cc/output/compositor_frame.h" |
| 14 #include "cc/output/compositor_frame_metadata.h" | 14 #include "cc/output/compositor_frame_metadata.h" |
| 15 #include "cc/output/copy_output_request.h" | 15 #include "cc/output/copy_output_request.h" |
| 16 #include "cc/surfaces/surface.h" | 16 #include "cc/surfaces/surface.h" |
| 17 #include "cc/surfaces/surface_manager.h" | 17 #include "cc/surfaces/surface_manager.h" |
| 18 #include "content/browser/browser_thread_impl.h" | 18 #include "content/browser/browser_thread_impl.h" |
| 19 #include "content/browser/compositor/resize_lock.h" | 19 #include "content/browser/compositor/resize_lock.h" |
| 20 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" | 20 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" |
| 21 #include "content/browser/frame_host/render_widget_host_view_guest.h" | 21 #include "content/browser/frame_host/render_widget_host_view_guest.h" |
| 22 #include "content/browser/renderer_host/input/web_input_event_util.h" |
| 22 #include "content/browser/renderer_host/overscroll_controller.h" | 23 #include "content/browser/renderer_host/overscroll_controller.h" |
| 23 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 24 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
| 24 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 25 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 25 #include "content/browser/renderer_host/render_widget_host_impl.h" | 26 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 26 #include "content/common/gpu/client/gl_helper.h" | 27 #include "content/common/gpu/client/gl_helper.h" |
| 27 #include "content/common/gpu/gpu_messages.h" | 28 #include "content/common/gpu/gpu_messages.h" |
| 28 #include "content/common/host_shared_bitmap_manager.h" | 29 #include "content/common/host_shared_bitmap_manager.h" |
| 29 #include "content/common/input/synthetic_web_input_event_builders.h" | 30 #include "content/common/input/synthetic_web_input_event_builders.h" |
| 30 #include "content/common/input_messages.h" | 31 #include "content/common/input_messages.h" |
| 31 #include "content/common/view_messages.h" | 32 #include "content/common/view_messages.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } | 262 } |
| 262 | 263 |
| 263 // A lock that doesn't actually do anything to the compositor, and does not | 264 // A lock that doesn't actually do anything to the compositor, and does not |
| 264 // time out. | 265 // time out. |
| 265 class FakeResizeLock : public ResizeLock { | 266 class FakeResizeLock : public ResizeLock { |
| 266 public: | 267 public: |
| 267 FakeResizeLock(const gfx::Size new_size, bool defer_compositor_lock) | 268 FakeResizeLock(const gfx::Size new_size, bool defer_compositor_lock) |
| 268 : ResizeLock(new_size, defer_compositor_lock) {} | 269 : ResizeLock(new_size, defer_compositor_lock) {} |
| 269 }; | 270 }; |
| 270 | 271 |
| 272 void OnTouchEvent(ui::TouchEvent* event) override { |
| 273 RenderWidgetHostViewAura::OnTouchEvent(event); |
| 274 if (pointer_state().GetPointerCount() > 0) { |
| 275 touch_event_.reset( |
| 276 new blink::WebTouchEvent(CreateWebTouchEventFromMotionEvent( |
| 277 pointer_state(), event->may_cause_scrolling()))); |
| 278 } else { |
| 279 // Never create a WebTouchEvent with 0 touch points. |
| 280 touch_event_.reset(); |
| 281 } |
| 282 } |
| 283 |
| 271 bool has_resize_lock_; | 284 bool has_resize_lock_; |
| 272 gfx::Size last_frame_size_; | 285 gfx::Size last_frame_size_; |
| 273 scoped_ptr<cc::CopyOutputRequest> last_copy_request_; | 286 scoped_ptr<cc::CopyOutputRequest> last_copy_request_; |
| 287 // null if there are 0 active touch points. |
| 288 scoped_ptr<blink::WebTouchEvent> touch_event_; |
| 274 }; | 289 }; |
| 275 | 290 |
| 276 // A layout manager that always resizes a child to the root window size. | 291 // A layout manager that always resizes a child to the root window size. |
| 277 class FullscreenLayoutManager : public aura::LayoutManager { | 292 class FullscreenLayoutManager : public aura::LayoutManager { |
| 278 public: | 293 public: |
| 279 explicit FullscreenLayoutManager(aura::Window* owner) : owner_(owner) {} | 294 explicit FullscreenLayoutManager(aura::Window* owner) : owner_(owner) {} |
| 280 ~FullscreenLayoutManager() override {} | 295 ~FullscreenLayoutManager() override {} |
| 281 | 296 |
| 282 // Overridden from aura::LayoutManager: | 297 // Overridden from aura::LayoutManager: |
| 283 void OnWindowResized() override { | 298 void OnWindowResized() override { |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 gfx::Point(20, 20), | 998 gfx::Point(20, 20), |
| 984 0, | 999 0, |
| 985 ui::EventTimeForNow()); | 1000 ui::EventTimeForNow()); |
| 986 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, | 1001 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, |
| 987 gfx::Point(20, 20), | 1002 gfx::Point(20, 20), |
| 988 0, | 1003 0, |
| 989 ui::EventTimeForNow()); | 1004 ui::EventTimeForNow()); |
| 990 | 1005 |
| 991 view_->OnTouchEvent(&press); | 1006 view_->OnTouchEvent(&press); |
| 992 EXPECT_FALSE(press.handled()); | 1007 EXPECT_FALSE(press.handled()); |
| 993 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_.type); | 1008 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_->type); |
| 994 EXPECT_TRUE(view_->touch_event_.cancelable); | 1009 EXPECT_TRUE(view_->touch_event_->cancelable); |
| 995 EXPECT_EQ(1U, view_->touch_event_.touchesLength); | 1010 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 996 EXPECT_EQ(blink::WebTouchPoint::StatePressed, | 1011 EXPECT_EQ(blink::WebTouchPoint::StatePressed, |
| 997 view_->touch_event_.touches[0].state); | 1012 view_->touch_event_->touches[0].state); |
| 998 | 1013 |
| 999 view_->OnTouchEvent(&move); | 1014 view_->OnTouchEvent(&move); |
| 1000 EXPECT_FALSE(move.handled()); | 1015 EXPECT_FALSE(move.handled()); |
| 1001 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_.type); | 1016 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_->type); |
| 1002 EXPECT_TRUE(view_->touch_event_.cancelable); | 1017 EXPECT_TRUE(view_->touch_event_->cancelable); |
| 1003 EXPECT_EQ(1U, view_->touch_event_.touchesLength); | 1018 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 1004 EXPECT_EQ(blink::WebTouchPoint::StateMoved, | 1019 EXPECT_EQ(blink::WebTouchPoint::StateMoved, |
| 1005 view_->touch_event_.touches[0].state); | 1020 view_->touch_event_->touches[0].state); |
| 1006 | 1021 |
| 1007 view_->OnTouchEvent(&release); | 1022 view_->OnTouchEvent(&release); |
| 1008 EXPECT_FALSE(release.handled()); | 1023 EXPECT_FALSE(release.handled()); |
| 1009 EXPECT_EQ(blink::WebInputEvent::TouchEnd, view_->touch_event_.type); | 1024 EXPECT_EQ(nullptr, view_->touch_event_); |
| 1010 EXPECT_TRUE(view_->touch_event_.cancelable); | |
| 1011 EXPECT_EQ(0U, view_->touch_event_.touchesLength); | |
| 1012 | 1025 |
| 1013 // Now install some touch-event handlers and do the same steps. The touch | 1026 // Now install some touch-event handlers and do the same steps. The touch |
| 1014 // events should now be consumed. However, the touch-event state should be | 1027 // events should now be consumed. However, the touch-event state should be |
| 1015 // updated as before. | 1028 // updated as before. |
| 1016 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); | 1029 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); |
| 1017 EXPECT_TRUE(widget_host_->ShouldForwardTouchEvent()); | 1030 EXPECT_TRUE(widget_host_->ShouldForwardTouchEvent()); |
| 1018 | 1031 |
| 1019 view_->OnTouchEvent(&press); | 1032 view_->OnTouchEvent(&press); |
| 1020 EXPECT_TRUE(press.synchronous_handling_disabled()); | 1033 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1021 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_.type); | 1034 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_->type); |
| 1022 EXPECT_TRUE(view_->touch_event_.cancelable); | 1035 EXPECT_TRUE(view_->touch_event_->cancelable); |
| 1023 EXPECT_EQ(1U, view_->touch_event_.touchesLength); | 1036 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 1024 EXPECT_EQ(blink::WebTouchPoint::StatePressed, | 1037 EXPECT_EQ(blink::WebTouchPoint::StatePressed, |
| 1025 view_->touch_event_.touches[0].state); | 1038 view_->touch_event_->touches[0].state); |
| 1026 | 1039 |
| 1027 view_->OnTouchEvent(&move); | 1040 view_->OnTouchEvent(&move); |
| 1028 EXPECT_TRUE(move.synchronous_handling_disabled()); | 1041 EXPECT_TRUE(move.synchronous_handling_disabled()); |
| 1029 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_.type); | 1042 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_->type); |
| 1030 EXPECT_TRUE(view_->touch_event_.cancelable); | 1043 EXPECT_TRUE(view_->touch_event_->cancelable); |
| 1031 EXPECT_EQ(1U, view_->touch_event_.touchesLength); | 1044 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 1032 EXPECT_EQ(blink::WebTouchPoint::StateMoved, | 1045 EXPECT_EQ(blink::WebTouchPoint::StateMoved, |
| 1033 view_->touch_event_.touches[0].state); | 1046 view_->touch_event_->touches[0].state); |
| 1034 | |
| 1035 view_->OnTouchEvent(&release); | 1047 view_->OnTouchEvent(&release); |
| 1036 EXPECT_TRUE(release.synchronous_handling_disabled()); | 1048 EXPECT_TRUE(release.synchronous_handling_disabled()); |
| 1037 EXPECT_EQ(blink::WebInputEvent::TouchEnd, view_->touch_event_.type); | 1049 EXPECT_EQ(nullptr, view_->touch_event_); |
| 1038 EXPECT_TRUE(view_->touch_event_.cancelable); | |
| 1039 EXPECT_EQ(0U, view_->touch_event_.touchesLength); | |
| 1040 | 1050 |
| 1041 // Now start a touch event, and remove the event-handlers before the release. | 1051 // Now start a touch event, and remove the event-handlers before the release. |
| 1042 view_->OnTouchEvent(&press); | 1052 view_->OnTouchEvent(&press); |
| 1043 EXPECT_TRUE(press.synchronous_handling_disabled()); | 1053 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1044 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_.type); | 1054 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_->type); |
| 1045 EXPECT_EQ(1U, view_->touch_event_.touchesLength); | 1055 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 1046 EXPECT_EQ(blink::WebTouchPoint::StatePressed, | 1056 EXPECT_EQ(blink::WebTouchPoint::StatePressed, |
| 1047 view_->touch_event_.touches[0].state); | 1057 view_->touch_event_->touches[0].state); |
| 1048 | 1058 |
| 1049 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, false)); | 1059 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, false)); |
| 1050 EXPECT_TRUE(widget_host_->ShouldForwardTouchEvent()); | 1060 EXPECT_TRUE(widget_host_->ShouldForwardTouchEvent()); |
| 1051 | 1061 |
| 1052 // Ack'ing the outstanding event should flush the pending touch queue. | 1062 // Ack'ing the outstanding event should flush the pending touch queue. |
| 1053 InputHostMsg_HandleInputEvent_ACK_Params ack; | 1063 InputHostMsg_HandleInputEvent_ACK_Params ack; |
| 1054 ack.type = blink::WebInputEvent::TouchStart; | 1064 ack.type = blink::WebInputEvent::TouchStart; |
| 1055 ack.state = INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | 1065 ack.state = INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
| 1056 widget_host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); | 1066 widget_host_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); |
| 1057 EXPECT_FALSE(widget_host_->ShouldForwardTouchEvent()); | 1067 EXPECT_FALSE(widget_host_->ShouldForwardTouchEvent()); |
| 1058 | 1068 |
| 1059 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0, | 1069 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(20, 20), 0, |
| 1060 base::Time::NowFromSystemTime() - base::Time()); | 1070 base::Time::NowFromSystemTime() - base::Time()); |
| 1061 view_->OnTouchEvent(&move2); | 1071 view_->OnTouchEvent(&move2); |
| 1062 EXPECT_FALSE(move2.handled()); | 1072 EXPECT_FALSE(move2.handled()); |
| 1063 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_.type); | 1073 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_->type); |
| 1064 EXPECT_EQ(1U, view_->touch_event_.touchesLength); | 1074 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 1065 EXPECT_EQ(blink::WebTouchPoint::StateMoved, | 1075 EXPECT_EQ(blink::WebTouchPoint::StateMoved, |
| 1066 view_->touch_event_.touches[0].state); | 1076 view_->touch_event_->touches[0].state); |
| 1067 | 1077 |
| 1068 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 0, | 1078 ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(20, 20), 0, |
| 1069 base::Time::NowFromSystemTime() - base::Time()); | 1079 base::Time::NowFromSystemTime() - base::Time()); |
| 1070 view_->OnTouchEvent(&release2); | 1080 view_->OnTouchEvent(&release2); |
| 1071 EXPECT_FALSE(release2.handled()); | 1081 EXPECT_FALSE(release2.handled()); |
| 1072 EXPECT_EQ(blink::WebInputEvent::TouchEnd, view_->touch_event_.type); | 1082 EXPECT_EQ(nullptr, view_->touch_event_); |
| 1073 EXPECT_EQ(0U, view_->touch_event_.touchesLength); | |
| 1074 } | 1083 } |
| 1075 | 1084 |
| 1076 // Checks that touch-events are queued properly when there is a touch-event | 1085 // Checks that touch-events are queued properly when there is a touch-event |
| 1077 // handler on the page. | 1086 // handler on the page. |
| 1078 TEST_F(RenderWidgetHostViewAuraTest, TouchEventSyncAsync) { | 1087 TEST_F(RenderWidgetHostViewAuraTest, TouchEventSyncAsync) { |
| 1079 view_->InitAsChild(NULL); | 1088 view_->InitAsChild(NULL); |
| 1080 view_->Show(); | 1089 view_->Show(); |
| 1081 | 1090 |
| 1082 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); | 1091 widget_host_->OnMessageReceived(ViewHostMsg_HasTouchEventHandlers(0, true)); |
| 1083 EXPECT_TRUE(widget_host_->ShouldForwardTouchEvent()); | 1092 EXPECT_TRUE(widget_host_->ShouldForwardTouchEvent()); |
| 1084 | 1093 |
| 1085 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, | 1094 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, |
| 1086 gfx::Point(30, 30), | 1095 gfx::Point(30, 30), |
| 1087 0, | 1096 0, |
| 1088 ui::EventTimeForNow()); | 1097 ui::EventTimeForNow()); |
| 1089 ui::TouchEvent move(ui::ET_TOUCH_MOVED, | 1098 ui::TouchEvent move(ui::ET_TOUCH_MOVED, |
| 1090 gfx::Point(20, 20), | 1099 gfx::Point(20, 20), |
| 1091 0, | 1100 0, |
| 1092 ui::EventTimeForNow()); | 1101 ui::EventTimeForNow()); |
| 1093 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, | 1102 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, |
| 1094 gfx::Point(20, 20), | 1103 gfx::Point(20, 20), |
| 1095 0, | 1104 0, |
| 1096 ui::EventTimeForNow()); | 1105 ui::EventTimeForNow()); |
| 1097 | 1106 |
| 1098 view_->OnTouchEvent(&press); | 1107 view_->OnTouchEvent(&press); |
| 1099 EXPECT_TRUE(press.synchronous_handling_disabled()); | 1108 EXPECT_TRUE(press.synchronous_handling_disabled()); |
| 1100 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_.type); | 1109 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_->type); |
| 1101 EXPECT_EQ(1U, view_->touch_event_.touchesLength); | 1110 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 1102 EXPECT_EQ(blink::WebTouchPoint::StatePressed, | 1111 EXPECT_EQ(blink::WebTouchPoint::StatePressed, |
| 1103 view_->touch_event_.touches[0].state); | 1112 view_->touch_event_->touches[0].state); |
| 1104 | 1113 |
| 1105 view_->OnTouchEvent(&move); | 1114 view_->OnTouchEvent(&move); |
| 1106 EXPECT_TRUE(move.synchronous_handling_disabled()); | 1115 EXPECT_TRUE(move.synchronous_handling_disabled()); |
| 1107 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_.type); | 1116 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_->type); |
| 1108 EXPECT_EQ(1U, view_->touch_event_.touchesLength); | 1117 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 1109 EXPECT_EQ(blink::WebTouchPoint::StateMoved, | 1118 EXPECT_EQ(blink::WebTouchPoint::StateMoved, |
| 1110 view_->touch_event_.touches[0].state); | 1119 view_->touch_event_->touches[0].state); |
| 1111 | 1120 |
| 1112 // Send the same move event. Since the point hasn't moved, it won't affect the | 1121 // Send the same move event. Since the point hasn't moved, it won't affect the |
| 1113 // queue. However, the view should consume the event. | 1122 // queue. However, the view should consume the event. |
| 1114 view_->OnTouchEvent(&move); | 1123 view_->OnTouchEvent(&move); |
| 1115 EXPECT_TRUE(move.synchronous_handling_disabled()); | 1124 EXPECT_TRUE(move.synchronous_handling_disabled()); |
| 1116 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_.type); | 1125 EXPECT_EQ(blink::WebInputEvent::TouchMove, view_->touch_event_->type); |
| 1117 EXPECT_EQ(1U, view_->touch_event_.touchesLength); | 1126 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 1118 EXPECT_EQ(blink::WebTouchPoint::StateMoved, | 1127 EXPECT_EQ(blink::WebTouchPoint::StateMoved, |
| 1119 view_->touch_event_.touches[0].state); | 1128 view_->touch_event_->touches[0].state); |
| 1120 | 1129 |
| 1121 view_->OnTouchEvent(&release); | 1130 view_->OnTouchEvent(&release); |
| 1122 EXPECT_TRUE(release.synchronous_handling_disabled()); | 1131 EXPECT_TRUE(release.synchronous_handling_disabled()); |
| 1123 EXPECT_EQ(blink::WebInputEvent::TouchEnd, view_->touch_event_.type); | 1132 EXPECT_EQ(nullptr, view_->touch_event_); |
| 1124 EXPECT_EQ(0U, view_->touch_event_.touchesLength); | |
| 1125 } | 1133 } |
| 1126 | 1134 |
| 1127 TEST_F(RenderWidgetHostViewAuraTest, PhysicalBackingSizeWithScale) { | 1135 TEST_F(RenderWidgetHostViewAuraTest, PhysicalBackingSizeWithScale) { |
| 1128 view_->InitAsChild(NULL); | 1136 view_->InitAsChild(NULL); |
| 1129 aura::client::ParentWindowWithContext( | 1137 aura::client::ParentWindowWithContext( |
| 1130 view_->GetNativeView(), | 1138 view_->GetNativeView(), |
| 1131 parent_view_->GetNativeView()->GetRootWindow(), | 1139 parent_view_->GetNativeView()->GetRootWindow(), |
| 1132 gfx::Rect()); | 1140 gfx::Rect()); |
| 1133 sink_->ClearMessages(); | 1141 sink_->ClearMessages(); |
| 1134 view_->SetSize(gfx::Size(100, 100)); | 1142 view_->SetSize(gfx::Size(100, 100)); |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2107 | 2115 |
| 2108 view_->InitAsChild(NULL); | 2116 view_->InitAsChild(NULL); |
| 2109 view_->Show(); | 2117 view_->Show(); |
| 2110 | 2118 |
| 2111 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, | 2119 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, |
| 2112 gfx::PointF(kX, kY), | 2120 gfx::PointF(kX, kY), |
| 2113 0, | 2121 0, |
| 2114 ui::EventTimeForNow()); | 2122 ui::EventTimeForNow()); |
| 2115 | 2123 |
| 2116 view_->OnTouchEvent(&press); | 2124 view_->OnTouchEvent(&press); |
| 2117 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_.type); | 2125 EXPECT_EQ(blink::WebInputEvent::TouchStart, view_->touch_event_->type); |
| 2118 EXPECT_TRUE(view_->touch_event_.cancelable); | 2126 EXPECT_TRUE(view_->touch_event_->cancelable); |
| 2119 EXPECT_EQ(1U, view_->touch_event_.touchesLength); | 2127 EXPECT_EQ(1U, view_->touch_event_->touchesLength); |
| 2120 EXPECT_EQ(blink::WebTouchPoint::StatePressed, | 2128 EXPECT_EQ(blink::WebTouchPoint::StatePressed, |
| 2121 view_->touch_event_.touches[0].state); | 2129 view_->touch_event_->touches[0].state); |
| 2122 EXPECT_EQ(kX, view_->touch_event_.touches[0].screenPosition.x); | 2130 EXPECT_EQ(kX, view_->touch_event_->touches[0].screenPosition.x); |
| 2123 EXPECT_EQ(kX, view_->touch_event_.touches[0].position.x); | 2131 EXPECT_EQ(kX, view_->touch_event_->touches[0].position.x); |
| 2124 EXPECT_EQ(kY, view_->touch_event_.touches[0].screenPosition.y); | 2132 EXPECT_EQ(kY, view_->touch_event_->touches[0].screenPosition.y); |
| 2125 EXPECT_EQ(kY, view_->touch_event_.touches[0].position.y); | 2133 EXPECT_EQ(kY, view_->touch_event_->touches[0].position.y); |
| 2126 } | 2134 } |
| 2127 | 2135 |
| 2128 // Tests that scroll ACKs are correctly handled by the overscroll-navigation | 2136 // Tests that scroll ACKs are correctly handled by the overscroll-navigation |
| 2129 // controller. | 2137 // controller. |
| 2130 TEST_F(RenderWidgetHostViewAuraOverscrollTest, WheelScrollEventOverscrolls) { | 2138 TEST_F(RenderWidgetHostViewAuraOverscrollTest, WheelScrollEventOverscrolls) { |
| 2131 SetUpOverscrollEnvironment(); | 2139 SetUpOverscrollEnvironment(); |
| 2132 | 2140 |
| 2133 // Simulate wheel events. | 2141 // Simulate wheel events. |
| 2134 SimulateWheelEvent(-5, 0, 0, true); // sent directly | 2142 SimulateWheelEvent(-5, 0, 0, true); // sent directly |
| 2135 SimulateWheelEvent(-1, 1, 0, true); // enqueued | 2143 SimulateWheelEvent(-1, 1, 0, true); // enqueued |
| (...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3065 const NativeWebKeyboardEvent* event = delegate_.last_event(); | 3073 const NativeWebKeyboardEvent* event = delegate_.last_event(); |
| 3066 EXPECT_NE(nullptr, event); | 3074 EXPECT_NE(nullptr, event); |
| 3067 if (event) { | 3075 if (event) { |
| 3068 EXPECT_EQ(key_event.key_code(), event->windowsKeyCode); | 3076 EXPECT_EQ(key_event.key_code(), event->windowsKeyCode); |
| 3069 EXPECT_EQ(ui::KeycodeConverter::DomCodeToNativeKeycode(key_event.code()), | 3077 EXPECT_EQ(ui::KeycodeConverter::DomCodeToNativeKeycode(key_event.code()), |
| 3070 event->nativeKeyCode); | 3078 event->nativeKeyCode); |
| 3071 } | 3079 } |
| 3072 } | 3080 } |
| 3073 | 3081 |
| 3074 } // namespace content | 3082 } // namespace content |
| OLD | NEW |