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

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

Issue 1894363004: Articulate the cancel behavior in WebMouseWheelEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_all_passive
Patch Set: Created 4 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 /* 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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 897
898 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html")); 898 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html"));
899 FrameTestHelpers::WebViewHelper webViewHelper; 899 FrameTestHelpers::WebViewHelper webViewHelper;
900 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); 900 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true);
901 int pageWidth = 640; 901 int pageWidth = 640;
902 int pageHeight = 480; 902 int pageHeight = 480;
903 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 903 webViewImpl->resize(WebSize(pageWidth, pageHeight));
904 webViewImpl->updateAllLifecyclePhases(); 904 webViewImpl->updateAllLifecyclePhases();
905 905
906 Document* document = toLocalFrame(webViewImpl->page()->mainFrame())->documen t(); 906 Document* document = toLocalFrame(webViewImpl->page()->mainFrame())->documen t();
907 WheelEvent* event = WheelEvent::create(FloatPoint(1, 3), FloatPoint(5, 10), 907 {
908 WheelEvent::DOM_DELTA_PAGE, document->domWindow(), IntPoint(2, 6), IntPo int(10, 30), 908 WheelEvent* event = WheelEvent::create(FloatPoint(1, 3), FloatPoint(5, 1 0),
909 PlatformEvent::CtrlKey, 0, 0, true, -1 /* null plugin id */, true /* has PreciseScrollingDeltas */, Event::RailsModeHorizontal); 909 WheelEvent::DOM_DELTA_PAGE, document->domWindow(), IntPoint(2, 6), I ntPoint(10, 30),
910 WebMouseWheelEventBuilder webMouseWheel(toLocalFrame(webViewImpl->page()->ma inFrame())->view(), document->layoutView(), *event); 910 PlatformEvent::CtrlKey, 0, 0, true, -1 /* null plugin id */, true /* hasPreciseScrollingDeltas */, Event::RailsModeHorizontal, true);
tdresser 2016/04/20 13:20:10 Add comment indicating what this flag indicates.
dtapuska 2016/04/20 14:03:04 Done.
911 EXPECT_EQ(1, webMouseWheel.wheelTicksX); 911 WebMouseWheelEventBuilder webMouseWheel(toLocalFrame(webViewImpl->page() ->mainFrame())->view(), document->layoutView(), *event);
912 EXPECT_EQ(3, webMouseWheel.wheelTicksY); 912 EXPECT_EQ(1, webMouseWheel.wheelTicksX);
913 EXPECT_EQ(5, webMouseWheel.deltaX); 913 EXPECT_EQ(3, webMouseWheel.wheelTicksY);
914 EXPECT_EQ(10, webMouseWheel.deltaY); 914 EXPECT_EQ(5, webMouseWheel.deltaX);
915 EXPECT_EQ(2, webMouseWheel.globalX); 915 EXPECT_EQ(10, webMouseWheel.deltaY);
916 EXPECT_EQ(6, webMouseWheel.globalY); 916 EXPECT_EQ(2, webMouseWheel.globalX);
917 EXPECT_EQ(10, webMouseWheel.windowX); 917 EXPECT_EQ(6, webMouseWheel.globalY);
918 EXPECT_EQ(30, webMouseWheel.windowY); 918 EXPECT_EQ(10, webMouseWheel.windowX);
919 EXPECT_TRUE(webMouseWheel.scrollByPage); 919 EXPECT_EQ(30, webMouseWheel.windowY);
920 EXPECT_EQ(WebInputEvent::ControlKey, webMouseWheel.modifiers); 920 EXPECT_TRUE(webMouseWheel.scrollByPage);
921 EXPECT_TRUE(webMouseWheel.canScroll); 921 EXPECT_EQ(WebInputEvent::ControlKey, webMouseWheel.modifiers);
922 EXPECT_EQ(WebInputEvent::RailsModeHorizontal, webMouseWheel.railsMode); 922 EXPECT_TRUE(webMouseWheel.canScroll);
923 EXPECT_TRUE(webMouseWheel.hasPreciseScrollingDeltas); 923 EXPECT_EQ(WebInputEvent::RailsModeHorizontal, webMouseWheel.railsMode);
924 EXPECT_TRUE(webMouseWheel.hasPreciseScrollingDeltas);
925 EXPECT_EQ(WebInputEvent::Blocking, webMouseWheel.dispatchType);
926 }
927
928 {
929 WheelEvent* event = WheelEvent::create(FloatPoint(1, 3), FloatPoint(5, 1 0),
930 WheelEvent::DOM_DELTA_PAGE, document->domWindow(), IntPoint(2, 6), I ntPoint(10, 30),
931 PlatformEvent::CtrlKey, 0, 0, true, -1 /* null plugin id */, true /* hasPreciseScrollingDeltas */, Event::RailsModeHorizontal, false);
932 WebMouseWheelEventBuilder webMouseWheel(toLocalFrame(webViewImpl->page() ->mainFrame())->view(), document->layoutView(), *event);
933 EXPECT_EQ(WebInputEvent::EventNonBlocking, webMouseWheel.dispatchType);
934 }
924 } 935 }
925 936
926 TEST(WebInputEventConversionTest, PlatformWheelEventBuilder) 937 TEST(WebInputEventConversionTest, PlatformWheelEventBuilder)
927 { 938 {
928 const std::string baseURL("http://www.test8.com/"); 939 const std::string baseURL("http://www.test8.com/");
929 const std::string fileName("fixed_layout.html"); 940 const std::string fileName("fixed_layout.html");
930 941
931 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html")); 942 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html"));
932 FrameTestHelpers::WebViewHelper webViewHelper; 943 FrameTestHelpers::WebViewHelper webViewHelper;
933 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); 944 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 EXPECT_EQ(5, platformGestureBuilder.position().y()); 1083 EXPECT_EQ(5, platformGestureBuilder.position().y());
1073 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); 1084 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x());
1074 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); 1085 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y());
1075 EXPECT_FALSE(platformGestureBuilder.inertial()); 1086 EXPECT_FALSE(platformGestureBuilder.inertial());
1076 EXPECT_TRUE(platformGestureBuilder.synthetic()); 1087 EXPECT_TRUE(platformGestureBuilder.synthetic());
1077 EXPECT_EQ(ScrollGranularity::ScrollByPage, platformGestureBuilder.deltaU nits()); 1088 EXPECT_EQ(ScrollGranularity::ScrollByPage, platformGestureBuilder.deltaU nits());
1078 } 1089 }
1079 } 1090 }
1080 1091
1081 } // namespace blink 1092 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698