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

Side by Side Diff: content/browser/renderer_host/input/input_router_impl_unittest.cc

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased, fixed a comment in web_input_event_builders_mac.mm Created 3 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/input/input_router_impl.h" 5 #include "content/browser/renderer_host/input/input_router_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 2085
2086 class InputRouterImplScaleMouseEventTest 2086 class InputRouterImplScaleMouseEventTest
2087 : public InputRouterImplScaleEventTest { 2087 : public InputRouterImplScaleEventTest {
2088 public: 2088 public:
2089 InputRouterImplScaleMouseEventTest() {} 2089 InputRouterImplScaleMouseEventTest() {}
2090 2090
2091 void RunMouseEventTest(const std::string& name, WebInputEvent::Type type) { 2091 void RunMouseEventTest(const std::string& name, WebInputEvent::Type type) {
2092 SCOPED_TRACE(name); 2092 SCOPED_TRACE(name);
2093 SimulateMouseEvent(type, 10, 10); 2093 SimulateMouseEvent(type, 10, 10);
2094 const WebMouseEvent* sent_event = GetSentWebInputEvent<WebMouseEvent>(); 2094 const WebMouseEvent* sent_event = GetSentWebInputEvent<WebMouseEvent>();
2095 EXPECT_EQ(20, sent_event->x); 2095 EXPECT_EQ(20, sent_event->positionInWidget().x);
2096 EXPECT_EQ(20, sent_event->y); 2096 EXPECT_EQ(20, sent_event->positionInWidget().y);
2097 2097
2098 const WebMouseEvent* filter_event = GetFilterWebInputEvent<WebMouseEvent>(); 2098 const WebMouseEvent* filter_event = GetFilterWebInputEvent<WebMouseEvent>();
2099 EXPECT_EQ(10, filter_event->x); 2099 EXPECT_EQ(10, filter_event->positionInWidget().x);
2100 EXPECT_EQ(10, filter_event->y); 2100 EXPECT_EQ(10, filter_event->positionInWidget().y);
2101 2101
2102 process_->sink().ClearMessages(); 2102 process_->sink().ClearMessages();
2103 } 2103 }
2104 2104
2105 private: 2105 private:
2106 DISALLOW_COPY_AND_ASSIGN(InputRouterImplScaleMouseEventTest); 2106 DISALLOW_COPY_AND_ASSIGN(InputRouterImplScaleMouseEventTest);
2107 }; 2107 };
2108 2108
2109 } // namespace 2109 } // namespace
2110 2110
2111 TEST_F(InputRouterImplScaleMouseEventTest, ScaleMouseEventTest) { 2111 TEST_F(InputRouterImplScaleMouseEventTest, ScaleMouseEventTest) {
2112 RunMouseEventTest("Enter", WebInputEvent::MouseEnter); 2112 RunMouseEventTest("Enter", WebInputEvent::MouseEnter);
2113 RunMouseEventTest("Down", WebInputEvent::MouseDown); 2113 RunMouseEventTest("Down", WebInputEvent::MouseDown);
2114 RunMouseEventTest("Move", WebInputEvent::MouseMove); 2114 RunMouseEventTest("Move", WebInputEvent::MouseMove);
2115 RunMouseEventTest("Up", WebInputEvent::MouseUp); 2115 RunMouseEventTest("Up", WebInputEvent::MouseUp);
2116 } 2116 }
2117 2117
2118 TEST_F(InputRouterImplScaleEventTest, ScaleMouseWheelEventTest) { 2118 TEST_F(InputRouterImplScaleEventTest, ScaleMouseWheelEventTest) {
2119 ASSERT_EQ(0u, process_->sink().message_count()); 2119 ASSERT_EQ(0u, process_->sink().message_count());
2120 SimulateWheelEvent(5, 5, 10, 10, 0, false); 2120 SimulateWheelEvent(5, 5, 10, 10, 0, false);
2121 ASSERT_EQ(1u, process_->sink().message_count()); 2121 ASSERT_EQ(1u, process_->sink().message_count());
2122 2122
2123 const WebMouseWheelEvent* sent_event = 2123 const WebMouseWheelEvent* sent_event =
2124 GetSentWebInputEvent<WebMouseWheelEvent>(); 2124 GetSentWebInputEvent<WebMouseWheelEvent>();
2125 EXPECT_EQ(10, sent_event->x); 2125 EXPECT_EQ(10, sent_event->positionInWidget().x);
2126 EXPECT_EQ(10, sent_event->y); 2126 EXPECT_EQ(10, sent_event->positionInWidget().y);
2127 EXPECT_EQ(20, sent_event->deltaX); 2127 EXPECT_EQ(20, sent_event->deltaX);
2128 EXPECT_EQ(20, sent_event->deltaY); 2128 EXPECT_EQ(20, sent_event->deltaY);
2129 EXPECT_EQ(2, sent_event->wheelTicksX); 2129 EXPECT_EQ(2, sent_event->wheelTicksX);
2130 EXPECT_EQ(2, sent_event->wheelTicksY); 2130 EXPECT_EQ(2, sent_event->wheelTicksY);
2131 2131
2132 const WebMouseWheelEvent* filter_event = 2132 const WebMouseWheelEvent* filter_event =
2133 GetFilterWebInputEvent<WebMouseWheelEvent>(); 2133 GetFilterWebInputEvent<WebMouseWheelEvent>();
2134 EXPECT_EQ(5, filter_event->x); 2134 EXPECT_EQ(5, filter_event->positionInWidget().x);
2135 EXPECT_EQ(5, filter_event->y); 2135 EXPECT_EQ(5, filter_event->positionInWidget().y);
2136 EXPECT_EQ(10, filter_event->deltaX); 2136 EXPECT_EQ(10, filter_event->deltaX);
2137 EXPECT_EQ(10, filter_event->deltaY); 2137 EXPECT_EQ(10, filter_event->deltaY);
2138 EXPECT_EQ(1, filter_event->wheelTicksX); 2138 EXPECT_EQ(1, filter_event->wheelTicksX);
2139 EXPECT_EQ(1, filter_event->wheelTicksY); 2139 EXPECT_EQ(1, filter_event->wheelTicksY);
2140 2140
2141 EXPECT_EQ(sent_event->accelerationRatioX, filter_event->accelerationRatioX); 2141 EXPECT_EQ(sent_event->accelerationRatioX, filter_event->accelerationRatioX);
2142 EXPECT_EQ(sent_event->accelerationRatioY, filter_event->accelerationRatioY); 2142 EXPECT_EQ(sent_event->accelerationRatioY, filter_event->accelerationRatioY);
2143 } 2143 }
2144 2144
2145 namespace { 2145 namespace {
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
2472 EXPECT_EQ(80, sent_event->data.flingStart.velocityY); 2472 EXPECT_EQ(80, sent_event->data.flingStart.velocityY);
2473 2473
2474 const WebGestureEvent* filter_event = 2474 const WebGestureEvent* filter_event =
2475 GetFilterWebInputEvent<WebGestureEvent>(); 2475 GetFilterWebInputEvent<WebGestureEvent>();
2476 TestLocationInFilterEvent(filter_event, orig); 2476 TestLocationInFilterEvent(filter_event, orig);
2477 EXPECT_EQ(30, filter_event->data.flingStart.velocityX); 2477 EXPECT_EQ(30, filter_event->data.flingStart.velocityX);
2478 EXPECT_EQ(40, filter_event->data.flingStart.velocityY); 2478 EXPECT_EQ(40, filter_event->data.flingStart.velocityY);
2479 } 2479 }
2480 2480
2481 } // namespace content 2481 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/pointer_lock_browsertest.cc ('k') | content/browser/renderer_host/input/mouse_wheel_event_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698