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

Side by Side Diff: content/public/test/web_input_event_traits_unittest.cc

Issue 1602663003: Framelet Prototype 2016 using Mojo IPC Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Disabled oilpan Created 4 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
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 #include "content/common/input/web_input_event_traits.h" 5 #include "content/public/common/input/web_input_event_traits.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/WebKit/public/web/WebInputEvent.h" 10 #include "third_party/WebKit/public/web/WebInputEvent.h"
11 11
12 using blink::WebGestureEvent; 12 using blink::WebGestureEvent;
13 using blink::WebInputEvent; 13 using blink::WebInputEvent;
14 using blink::WebKeyboardEvent; 14 using blink::WebKeyboardEvent;
15 using blink::WebMouseEvent; 15 using blink::WebMouseEvent;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 pinch0 = CreateGesture(WebInputEvent::GesturePinchUpdate, 1, 1); 167 pinch0 = CreateGesture(WebInputEvent::GesturePinchUpdate, 1, 1);
168 pinch0.data.pinchUpdate.scale = numeric_limits<float>::max() / 2.0f; 168 pinch0.data.pinchUpdate.scale = numeric_limits<float>::max() / 2.0f;
169 pinch1 = CreateGesture(WebInputEvent::GesturePinchUpdate, 1, 1); 169 pinch1 = CreateGesture(WebInputEvent::GesturePinchUpdate, 1, 1);
170 pinch1.data.pinchUpdate.scale = 10.0f; 170 pinch1.data.pinchUpdate.scale = 10.0f;
171 EXPECT_TRUE(WebInputEventTraits::CanCoalesce(pinch0, pinch1)); 171 EXPECT_TRUE(WebInputEventTraits::CanCoalesce(pinch0, pinch1));
172 WebInputEventTraits::Coalesce(pinch0, &pinch1); 172 WebInputEventTraits::Coalesce(pinch0, &pinch1);
173 EXPECT_EQ(numeric_limits<float>::max(), pinch1.data.pinchUpdate.scale); 173 EXPECT_EQ(numeric_limits<float>::max(), pinch1.data.pinchUpdate.scale);
174 } 174 }
175 175
176 TEST_F(WebInputEventTraitsTest, WebMouseWheelEventCoalescing) { 176 TEST_F(WebInputEventTraitsTest, WebMouseWheelEventCoalescing) {
177 WebMouseWheelEvent mouse_wheel_0 = 177 WebMouseWheelEvent mouse_wheel_0 = CreateMouseWheel(1, 1, true);
178 CreateMouseWheel(1, 1, true); 178 WebMouseWheelEvent mouse_wheel_1 = CreateMouseWheel(2, 2, true);
179 WebMouseWheelEvent mouse_wheel_1 =
180 CreateMouseWheel(2, 2, true);
181 179
182 // WebMouseWheelEvent objects with same values except different deltaX and 180 // WebMouseWheelEvent objects with same values except different deltaX and
183 // deltaY should coalesce. 181 // deltaY should coalesce.
184 EXPECT_TRUE(WebInputEventTraits::CanCoalesce(mouse_wheel_0, mouse_wheel_1)); 182 EXPECT_TRUE(WebInputEventTraits::CanCoalesce(mouse_wheel_0, mouse_wheel_1));
185 183
186 mouse_wheel_0 = CreateMouseWheel(1, 1, true); 184 mouse_wheel_0 = CreateMouseWheel(1, 1, true);
187 mouse_wheel_1 = CreateMouseWheel(1, 1, false); 185 mouse_wheel_1 = CreateMouseWheel(1, 1, false);
188 186
189 // WebMouseWheelEvent objects with different canScroll values should not 187 // WebMouseWheelEvent objects with different canScroll values should not
190 // coalesce. 188 // coalesce.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 WebGestureEvent gesture = 225 WebGestureEvent gesture =
228 CreateGesture(WebInputEvent::GesturePinchBegin, 1, 1); 226 CreateGesture(WebInputEvent::GesturePinchBegin, 1, 1);
229 EXPECT_FALSE(WebInputEventTraits::ToString(gesture).empty()); 227 EXPECT_FALSE(WebInputEventTraits::ToString(gesture).empty());
230 228
231 WebTouchEvent touch = CreateTouch(WebInputEvent::TouchStart); 229 WebTouchEvent touch = CreateTouch(WebInputEvent::TouchStart);
232 EXPECT_FALSE(WebInputEventTraits::ToString(touch).empty()); 230 EXPECT_FALSE(WebInputEventTraits::ToString(touch).empty());
233 } 231 }
234 232
235 } // namespace 233 } // namespace
236 } // namespace content 234 } // namespace content
OLDNEW
« no previous file with comments | « content/public/renderer/content_renderer_client.cc ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698