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

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: Rebase 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 */,
911 EXPECT_EQ(1, webMouseWheel.wheelTicksX); 911 true /* hasPreciseScrollingDeltas */, Event::RailsModeHorizontal, tr ue /*cancelable*/);
912 EXPECT_EQ(3, webMouseWheel.wheelTicksY); 912 WebMouseWheelEventBuilder webMouseWheel(toLocalFrame(webViewImpl->page() ->mainFrame())->view(), document->layoutView(), *event);
913 EXPECT_EQ(5, webMouseWheel.deltaX); 913 EXPECT_EQ(1, webMouseWheel.wheelTicksX);
914 EXPECT_EQ(10, webMouseWheel.deltaY); 914 EXPECT_EQ(3, webMouseWheel.wheelTicksY);
915 EXPECT_EQ(2, webMouseWheel.globalX); 915 EXPECT_EQ(5, webMouseWheel.deltaX);
916 EXPECT_EQ(6, webMouseWheel.globalY); 916 EXPECT_EQ(10, webMouseWheel.deltaY);
917 EXPECT_EQ(10, webMouseWheel.windowX); 917 EXPECT_EQ(2, webMouseWheel.globalX);
918 EXPECT_EQ(30, webMouseWheel.windowY); 918 EXPECT_EQ(6, webMouseWheel.globalY);
919 EXPECT_TRUE(webMouseWheel.scrollByPage); 919 EXPECT_EQ(10, webMouseWheel.windowX);
920 EXPECT_EQ(WebInputEvent::ControlKey, webMouseWheel.modifiers); 920 EXPECT_EQ(30, webMouseWheel.windowY);
921 EXPECT_TRUE(webMouseWheel.canScroll); 921 EXPECT_TRUE(webMouseWheel.scrollByPage);
922 EXPECT_EQ(WebInputEvent::RailsModeHorizontal, webMouseWheel.railsMode); 922 EXPECT_EQ(WebInputEvent::ControlKey, webMouseWheel.modifiers);
923 EXPECT_TRUE(webMouseWheel.hasPreciseScrollingDeltas); 923 EXPECT_TRUE(webMouseWheel.canScroll);
924 EXPECT_EQ(WebInputEvent::RailsModeHorizontal, webMouseWheel.railsMode);
925 EXPECT_TRUE(webMouseWheel.hasPreciseScrollingDeltas);
926 EXPECT_EQ(WebInputEvent::Blocking, webMouseWheel.dispatchType);
927 }
928
929 {
930 WheelEvent* event = WheelEvent::create(FloatPoint(1, 3), FloatPoint(5, 1 0),
931 WheelEvent::DOM_DELTA_PAGE, document->domWindow(), IntPoint(2, 6), I ntPoint(10, 30),
932 PlatformEvent::CtrlKey, 0, 0, true, -1 /* null plugin id */, true /* hasPreciseScrollingDeltas */, Event::RailsModeHorizontal, false);
933 WebMouseWheelEventBuilder webMouseWheel(toLocalFrame(webViewImpl->page() ->mainFrame())->view(), document->layoutView(), *event);
934 EXPECT_EQ(WebInputEvent::EventNonBlocking, webMouseWheel.dispatchType);
935 }
924 } 936 }
925 937
926 TEST(WebInputEventConversionTest, PlatformWheelEventBuilder) 938 TEST(WebInputEventConversionTest, PlatformWheelEventBuilder)
927 { 939 {
928 const std::string baseURL("http://www.test8.com/"); 940 const std::string baseURL("http://www.test8.com/");
929 const std::string fileName("fixed_layout.html"); 941 const std::string fileName("fixed_layout.html");
930 942
931 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html")); 943 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html"));
932 FrameTestHelpers::WebViewHelper webViewHelper; 944 FrameTestHelpers::WebViewHelper webViewHelper;
933 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); 945 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()); 1084 EXPECT_EQ(5, platformGestureBuilder.position().y());
1073 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x()); 1085 EXPECT_EQ(10, platformGestureBuilder.globalPosition().x());
1074 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y()); 1086 EXPECT_EQ(15, platformGestureBuilder.globalPosition().y());
1075 EXPECT_FALSE(platformGestureBuilder.inertial()); 1087 EXPECT_FALSE(platformGestureBuilder.inertial());
1076 EXPECT_TRUE(platformGestureBuilder.synthetic()); 1088 EXPECT_TRUE(platformGestureBuilder.synthetic());
1077 EXPECT_EQ(ScrollGranularity::ScrollByPage, platformGestureBuilder.deltaU nits()); 1089 EXPECT_EQ(ScrollGranularity::ScrollByPage, platformGestureBuilder.deltaU nits());
1078 } 1090 }
1079 } 1091 }
1080 1092
1081 } // namespace blink 1093 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebInputEventConversion.cpp ('k') | third_party/WebKit/public/web/WebInputEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698