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

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

Issue 1440923002: Convert the coordinates in WebInputEvent To Viewport in InputRouter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // Needed on Windows to get |M_PI| from <cmath>. 5 // Needed on Windows to get |M_PI| from <cmath>.
6 #ifdef _WIN32 6 #ifdef _WIN32
7 #define _USE_MATH_DEFINES 7 #define _USE_MATH_DEFINES
8 #endif 8 #endif
9 9
10 #include <cmath> 10 #include <cmath>
11 11
12 #include "content/browser/renderer_host/input/web_input_event_util.h" 12 #include "content/browser/renderer_host/input/web_input_event_util.h"
13 #include "content/common/input/synthetic_web_input_event_builders.h"
13 #include "content/common/input/web_input_event_traits.h" 14 #include "content/common/input/web_input_event_traits.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "ui/events/blink/blink_event_util.h" 16 #include "ui/events/blink/blink_event_util.h"
16 #include "ui/events/event_constants.h" 17 #include "ui/events/event_constants.h"
17 #include "ui/events/gesture_detection/gesture_event_data.h" 18 #include "ui/events/gesture_detection/gesture_event_data.h"
18 #include "ui/events/gesture_detection/motion_event_generic.h" 19 #include "ui/events/gesture_detection/motion_event_generic.h"
19 #include "ui/events/gesture_event_details.h" 20 #include "ui/events/gesture_event_details.h"
20 #include "ui/gfx/geometry/safe_integer_conversions.h" 21 #include "ui/gfx/geometry/safe_integer_conversions.h"
21 22
22 using blink::WebInputEvent; 23 using blink::WebInputEvent;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 EXPECT_EQ(gfx::ToFlooredInt(pos.x()), web_event.x); 116 EXPECT_EQ(gfx::ToFlooredInt(pos.x()), web_event.x);
116 EXPECT_EQ(gfx::ToFlooredInt(pos.y()), web_event.y); 117 EXPECT_EQ(gfx::ToFlooredInt(pos.y()), web_event.y);
117 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.x()), web_event.globalX); 118 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.x()), web_event.globalX);
118 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.y()), web_event.globalY); 119 EXPECT_EQ(gfx::ToFlooredInt(raw_pos.y()), web_event.globalY);
119 EXPECT_EQ(blink::WebGestureDeviceTouchscreen, web_event.sourceDevice); 120 EXPECT_EQ(blink::WebGestureDeviceTouchscreen, web_event.sourceDevice);
120 EXPECT_EQ(delta.x(), web_event.data.scrollUpdate.deltaX); 121 EXPECT_EQ(delta.x(), web_event.data.scrollUpdate.deltaX);
121 EXPECT_EQ(delta.y(), web_event.data.scrollUpdate.deltaY); 122 EXPECT_EQ(delta.y(), web_event.data.scrollUpdate.deltaY);
122 EXPECT_TRUE(web_event.data.scrollUpdate.previousUpdateInSequencePrevented); 123 EXPECT_TRUE(web_event.data.scrollUpdate.previousUpdateInSequencePrevented);
123 } 124 }
124 125
126 TEST(WebInputEventUtilTest, NoScalingWith1DSF) {
127 auto event =
128 SyntheticWebMouseEventBuilder::Build(blink::WebInputEvent::MouseMove,
129 10, 10, 0);
130 EXPECT_FALSE(ConvertWebInputEventToViewport(event, 1.f));
131 EXPECT_TRUE(ConvertWebInputEventToViewport(event, 2.f));
132 }
133
125 } // namespace content 134 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/web_input_event_util.cc ('k') | content/browser/renderer_host/render_widget_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698