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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 889673004: ozone: evdev: Use kernel timestamps for mouse events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on MouseEvent timestamp changes & fix stime feedback Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/events/event.h » ('j') | ui/events/event.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3101 matching lines...) Expand 10 before | Expand all | Expand 10 after
3112 } 3112 }
3113 } 3113 }
3114 3114
3115 TEST_F(RenderWidgetHostViewAuraTest, SetCanScrollForWebMouseWheelEvent) { 3115 TEST_F(RenderWidgetHostViewAuraTest, SetCanScrollForWebMouseWheelEvent) {
3116 view_->InitAsChild(NULL); 3116 view_->InitAsChild(NULL);
3117 view_->Show(); 3117 view_->Show();
3118 3118
3119 sink_->ClearMessages(); 3119 sink_->ClearMessages();
3120 3120
3121 // Simulates the mouse wheel event with ctrl modifier applied. 3121 // Simulates the mouse wheel event with ctrl modifier applied.
3122 ui::MouseWheelEvent event(gfx::Vector2d(1, 1), 3122 ui::MouseWheelEvent event(gfx::Vector2d(1, 1), gfx::Point(), gfx::Point(),
3123 gfx::Point(), gfx::Point(), 3123 ui::EventTimeForNow(), ui::EF_CONTROL_DOWN, 0);
3124 ui::EF_CONTROL_DOWN, 0);
3125 view_->OnMouseEvent(&event); 3124 view_->OnMouseEvent(&event);
3126 3125
3127 const WebInputEvent* input_event = 3126 const WebInputEvent* input_event =
3128 GetInputEventFromMessage(*sink_->GetMessageAt(0)); 3127 GetInputEventFromMessage(*sink_->GetMessageAt(0));
3129 const WebMouseWheelEvent* wheel_event = 3128 const WebMouseWheelEvent* wheel_event =
3130 static_cast<const WebMouseWheelEvent*>(input_event); 3129 static_cast<const WebMouseWheelEvent*>(input_event);
3131 // Check if the canScroll set to false when ctrl-scroll is generated from 3130 // Check if the canScroll set to false when ctrl-scroll is generated from
3132 // mouse wheel event. 3131 // mouse wheel event.
3133 EXPECT_FALSE(wheel_event->canScroll); 3132 EXPECT_FALSE(wheel_event->canScroll);
3134 sink_->ClearMessages(); 3133 sink_->ClearMessages();
3135 3134
3136 // Ack'ing the outstanding event should flush the pending event queue. 3135 // Ack'ing the outstanding event should flush the pending event queue.
3137 SendInputEventACK(blink::WebInputEvent::MouseWheel, 3136 SendInputEventACK(blink::WebInputEvent::MouseWheel,
3138 INPUT_EVENT_ACK_STATE_CONSUMED); 3137 INPUT_EVENT_ACK_STATE_CONSUMED);
3139 3138
3140 // Simulates the mouse wheel event with no modifier applied. 3139 // Simulates the mouse wheel event with no modifier applied.
3141 event = ui::MouseWheelEvent(gfx::Vector2d(1, 1), gfx::Point(), gfx::Point(), 3140 event = ui::MouseWheelEvent(gfx::Vector2d(1, 1), gfx::Point(), gfx::Point(),
3142 ui::EF_NONE, 0); 3141 ui::EventTimeForNow(), ui::EF_NONE, 0);
3143 3142
3144 view_->OnMouseEvent(&event); 3143 view_->OnMouseEvent(&event);
3145 3144
3146 input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0)); 3145 input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0));
3147 wheel_event = static_cast<const WebMouseWheelEvent*>(input_event); 3146 wheel_event = static_cast<const WebMouseWheelEvent*>(input_event);
3148 // Check if the canScroll set to true when no modifier is applied to the 3147 // Check if the canScroll set to true when no modifier is applied to the
3149 // mouse wheel event. 3148 // mouse wheel event.
3150 EXPECT_TRUE(wheel_event->canScroll); 3149 EXPECT_TRUE(wheel_event->canScroll);
3151 sink_->ClearMessages(); 3150 sink_->ClearMessages();
3152 3151
3153 SendInputEventACK(blink::WebInputEvent::MouseWheel, 3152 SendInputEventACK(blink::WebInputEvent::MouseWheel,
3154 INPUT_EVENT_ACK_STATE_CONSUMED); 3153 INPUT_EVENT_ACK_STATE_CONSUMED);
3155 3154
3156 // Simulates the scroll event with ctrl modifier applied. 3155 // Simulates the scroll event with ctrl modifier applied.
3157 ui::ScrollEvent scroll(ui::ET_SCROLL, gfx::Point(2, 2), ui::EventTimeForNow(), 3156 ui::ScrollEvent scroll(ui::ET_SCROLL, gfx::Point(2, 2), ui::EventTimeForNow(),
3158 ui::EF_CONTROL_DOWN, 0, 5, 0, 5, 2); 3157 ui::EF_CONTROL_DOWN, 0, 5, 0, 5, 2);
3159 view_->OnScrollEvent(&scroll); 3158 view_->OnScrollEvent(&scroll);
3160 3159
3161 input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0)); 3160 input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0));
3162 wheel_event = static_cast<const WebMouseWheelEvent*>(input_event); 3161 wheel_event = static_cast<const WebMouseWheelEvent*>(input_event);
3163 // Check if the canScroll set to true when ctrl-touchpad-scroll is generated 3162 // Check if the canScroll set to true when ctrl-touchpad-scroll is generated
3164 // from scroll event. 3163 // from scroll event.
3165 EXPECT_TRUE(wheel_event->canScroll); 3164 EXPECT_TRUE(wheel_event->canScroll);
3166 } 3165 }
3167 3166
3168 } // namespace content 3167 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ui/events/event.h » ('j') | ui/events/event.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698