| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 EXPECT_EQ(0, platformWheelBuilder.position().y()); | 986 EXPECT_EQ(0, platformWheelBuilder.position().y()); |
| 987 EXPECT_EQ(15, platformWheelBuilder.deltaX()); | 987 EXPECT_EQ(15, platformWheelBuilder.deltaX()); |
| 988 EXPECT_EQ(10, platformWheelBuilder.deltaY()); | 988 EXPECT_EQ(10, platformWheelBuilder.deltaY()); |
| 989 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.getModifiers()); | 989 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.getModifiers()); |
| 990 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); | 990 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); |
| 991 EXPECT_FALSE(platformWheelBuilder.canScroll()); | 991 EXPECT_FALSE(platformWheelBuilder.canScroll()); |
| 992 EXPECT_EQ(platformWheelBuilder.getRailsMode(), PlatformEvent::RailsModeV
ertical); | 992 EXPECT_EQ(platformWheelBuilder.getRailsMode(), PlatformEvent::RailsModeV
ertical); |
| 993 } | 993 } |
| 994 } | 994 } |
| 995 | 995 |
| 996 TEST(WebInputEventConversionTest, PlatformGestureEventBuilder) |
| 997 { |
| 998 const std::string baseURL("http://www.test8.com/"); |
| 999 const std::string fileName("fixed_layout.html"); |
| 1000 |
| 1001 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); |
| 1002 FrameTestHelpers::WebViewHelper webViewHelper; |
| 1003 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true); |
| 1004 int pageWidth = 640; |
| 1005 int pageHeight = 480; |
| 1006 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
| 1007 webViewImpl->updateAllLifecyclePhases(); |
| 1008 |
| 1009 FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view(); |
| 1010 |
| 1011 { |
| 1012 WebGestureEvent webGestureEvent; |
| 1013 webGestureEvent.type = WebInputEvent::GestureScrollBegin; |
| 1014 webGestureEvent.x = 0; |
| 1015 webGestureEvent.y = 5; |
| 1016 webGestureEvent.globalX = 10; |
| 1017 webGestureEvent.globalY = 15; |
| 1018 webGestureEvent.sourceDevice = WebGestureDeviceTouchpad; |
| 1019 webGestureEvent.resendingPluginId = 2; |
| 1020 webGestureEvent.data.scrollBegin.inertial = true; |
| 1021 webGestureEvent.data.scrollBegin.synthetic = true; |
| 1022 webGestureEvent.data.scrollBegin.deltaXHint = 100; |
| 1023 webGestureEvent.data.scrollBegin.deltaYHint = 10; |
| 1024 webGestureEvent.data.scrollBegin.deltaHintUnits = WebGestureEvent::Pixel
s; |
| 1025 |
| 1026 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent
); |
| 1027 EXPECT_EQ(PlatformGestureSourceTouchpad, platformGestureBuilder.source()
); |
| 1028 EXPECT_EQ(2, platformGestureBuilder.resendingPluginId()); |
| 1029 EXPECT_EQ(0, platformGestureBuilder.position().x()); |
| 1030 EXPECT_EQ(5, platformGestureBuilder.position().y()); |
| 1031 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); |
| 1032 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); |
| 1033 EXPECT_TRUE(platformGestureBuilder.inertial()); |
| 1034 EXPECT_TRUE(platformGestureBuilder.synthetic()); |
| 1035 EXPECT_EQ(100, platformGestureBuilder.deltaX()); |
| 1036 EXPECT_EQ(10, platformGestureBuilder.deltaY()); |
| 1037 EXPECT_EQ(ScrollGranularity::ScrollByPixel, platformGestureBuilder.delta
Units()); |
| 1038 } |
| 1039 |
| 1040 { |
| 1041 WebGestureEvent webGestureEvent; |
| 1042 webGestureEvent.type = WebInputEvent::GestureScrollEnd; |
| 1043 webGestureEvent.x = 0; |
| 1044 webGestureEvent.y = 5; |
| 1045 webGestureEvent.globalX = 10; |
| 1046 webGestureEvent.globalY = 15; |
| 1047 webGestureEvent.sourceDevice = WebGestureDeviceTouchpad; |
| 1048 webGestureEvent.resendingPluginId = 2; |
| 1049 webGestureEvent.data.scrollEnd.inertial = false; |
| 1050 webGestureEvent.data.scrollEnd.synthetic = true; |
| 1051 webGestureEvent.data.scrollEnd.deltaUnits = WebGestureEvent::Page; |
| 1052 |
| 1053 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent
); |
| 1054 EXPECT_EQ(PlatformGestureSourceTouchpad, platformGestureBuilder.source()
); |
| 1055 EXPECT_EQ(2, platformGestureBuilder.resendingPluginId()); |
| 1056 EXPECT_EQ(0, platformGestureBuilder.position().x()); |
| 1057 EXPECT_EQ(5, platformGestureBuilder.position().y()); |
| 1058 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); |
| 1059 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); |
| 1060 EXPECT_FALSE(platformGestureBuilder.inertial()); |
| 1061 EXPECT_TRUE(platformGestureBuilder.synthetic()); |
| 1062 EXPECT_EQ(ScrollGranularity::ScrollByPage, platformGestureBuilder.deltaU
nits()); |
| 1063 } |
| 1064 } |
| 1065 |
| 996 } // namespace blink | 1066 } // namespace blink |
| OLD | NEW |