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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 819993002: Revert of Explicitly suppress scrolling for wheel events that will trigger zooming (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/render_widget_host_view_aura_unittest.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index 9bdfbcce441b50b378008b516730835e2b1ef736..13d986b9f51b8d5c67793e1097d8c600c33354ca 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -308,15 +308,6 @@
MOCK_METHOD2(OnDelegatedFrameDamage, void(aura::Window*, const gfx::Rect&));
};
-const WebInputEvent* GetInputEventFromMessage(const IPC::Message& message) {
- PickleIterator iter(message);
- const char* data;
- int data_length;
- if (!iter.ReadData(&data, &data_length))
- return NULL;
- return reinterpret_cast<const WebInputEvent*>(data);
-}
-
} // namespace
class RenderWidgetHostViewAuraTest : public testing::Test {
@@ -397,15 +388,6 @@
RendererFrameManager::GetInstance()->OnMemoryPressure(level);
}
- void SendInputEventACK(WebInputEvent::Type type,
- InputEventAckState ack_result) {
- InputHostMsg_HandleInputEvent_ACK_Params ack;
- ack.type = type;
- ack.state = ack_result;
- InputHostMsg_HandleInputEvent_ACK response(0, ack);
- widget_host_->OnMessageReceived(response);
- }
-
protected:
// If true, then calls RWH::Shutdown() instead of deleting RWH.
bool widget_host_uses_shutdown_to_destroy_;
@@ -596,6 +578,15 @@
blink::WebGestureDevice sourceDevice) {
SimulateGestureEventCore(SyntheticWebGestureEventBuilder::BuildFling(
velocityX, velocityY, sourceDevice));
+ }
+
+ void SendInputEventACK(WebInputEvent::Type type,
+ InputEventAckState ack_result) {
+ InputHostMsg_HandleInputEvent_ACK_Params ack;
+ ack.type = type;
+ ack.state = ack_result;
+ InputHostMsg_HandleInputEvent_ACK response(0, ack);
+ widget_host_->OnMessageReceived(response);
}
bool ScrollStateIsContentScrolling() const {
@@ -3080,57 +3071,4 @@
}
}
-TEST_F(RenderWidgetHostViewAuraTest, SetCanScrollForWebMouseWheelEvent) {
- view_->InitAsChild(NULL);
- view_->Show();
-
- sink_->ClearMessages();
-
- // Simulates the mouse wheel event with ctrl modifier applied.
- ui::MouseWheelEvent event(gfx::Vector2d(1, 1),
- gfx::Point(), gfx::Point(),
- ui::EF_CONTROL_DOWN, 0);
- view_->OnMouseEvent(&event);
-
- const WebInputEvent* input_event =
- GetInputEventFromMessage(*sink_->GetMessageAt(0));
- const WebMouseWheelEvent* wheel_event =
- static_cast<const WebMouseWheelEvent*>(input_event);
- // Check if the canScroll set to false when ctrl-scroll is generated from
- // mouse wheel event.
- EXPECT_FALSE(wheel_event->canScroll);
- sink_->ClearMessages();
-
- // Ack'ing the outstanding event should flush the pending event queue.
- SendInputEventACK(blink::WebInputEvent::MouseWheel,
- INPUT_EVENT_ACK_STATE_CONSUMED);
-
- // Simulates the mouse wheel event with no modifier applied.
- event = ui::MouseWheelEvent(gfx::Vector2d(1, 1), gfx::Point(), gfx::Point(),
- ui::EF_NONE, 0);
-
- view_->OnMouseEvent(&event);
-
- input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0));
- wheel_event = static_cast<const WebMouseWheelEvent*>(input_event);
- // Check if the canScroll set to true when no modifier is applied to the
- // mouse wheel event.
- EXPECT_TRUE(wheel_event->canScroll);
- sink_->ClearMessages();
-
- SendInputEventACK(blink::WebInputEvent::MouseWheel,
- INPUT_EVENT_ACK_STATE_CONSUMED);
-
- // Simulates the scroll event with ctrl modifier applied.
- ui::ScrollEvent scroll(ui::ET_SCROLL, gfx::Point(2, 2), ui::EventTimeForNow(),
- ui::EF_CONTROL_DOWN, 0, 5, 0, 5, 2);
- view_->OnScrollEvent(&scroll);
-
- input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0));
- wheel_event = static_cast<const WebMouseWheelEvent*>(input_event);
- // Check if the canScroll set to true when ctrl-touchpad-scroll is generated
- // from scroll event.
- EXPECT_TRUE(wheel_event->canScroll);
-}
-
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698