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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp

Issue 1829743003: Fix missing fields in GestureScrollBegin/Update/End event conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 /* 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
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;
tdresser 2016/03/23 16:58:47 Looks like you're missing an expectation for resen
dtapuska 2016/03/23 17:25:30 Done.
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(0, platformGestureBuilder.position().x());
1028 EXPECT_EQ(5, platformGestureBuilder.position().y());
1029 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x());
1030 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y());
1031 EXPECT_TRUE(platformGestureBuilder.inertial());
1032 EXPECT_TRUE(platformGestureBuilder.synthetic());
1033 EXPECT_EQ(100, platformGestureBuilder.deltaX());
1034 EXPECT_EQ(10, platformGestureBuilder.deltaY());
1035 EXPECT_EQ(ScrollGranularity::ScrollByPixel, platformGestureBuilder.delta Units());
1036 }
1037
1038 {
1039 WebGestureEvent webGestureEvent;
1040 webGestureEvent.type = WebInputEvent::GestureScrollEnd;
1041 webGestureEvent.x = 0;
1042 webGestureEvent.y = 5;
1043 webGestureEvent.globalX = 10;
1044 webGestureEvent.globalY = 15;
1045 webGestureEvent.sourceDevice = WebGestureDeviceTouchpad;
1046 webGestureEvent.resendingPluginId = 2;
1047 webGestureEvent.data.scrollEnd.inertial = false;
1048 webGestureEvent.data.scrollEnd.synthetic = true;
1049 webGestureEvent.data.scrollEnd.deltaUnits = WebGestureEvent::Page;
1050
1051 PlatformGestureEventBuilder platformGestureBuilder(view, webGestureEvent );
1052 EXPECT_EQ(0, platformGestureBuilder.position().x());
1053 EXPECT_EQ(5, platformGestureBuilder.position().y());
1054 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x());
1055 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y());
1056 EXPECT_FALSE(platformGestureBuilder.inertial());
1057 EXPECT_TRUE(platformGestureBuilder.synthetic());
1058 EXPECT_EQ(ScrollGranularity::ScrollByPage, platformGestureBuilder.deltaU nits());
1059 }
1060 }
1061
996 } // namespace blink 1062 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698