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

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

Issue 1413513009: Use mocked scrollbar in webkit unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 int getModifiersForKeyLocationCode(KeyboardEvent::KeyLocationCode location) 60 int getModifiersForKeyLocationCode(KeyboardEvent::KeyLocationCode location)
61 { 61 {
62 RefPtrWillBeRawPtr<KeyboardEvent> event = createKeyboardEventWithLocation(lo cation); 62 RefPtrWillBeRawPtr<KeyboardEvent> event = createKeyboardEventWithLocation(lo cation);
63 WebKeyboardEventBuilder convertedEvent(*event); 63 WebKeyboardEventBuilder convertedEvent(*event);
64 return convertedEvent.modifiers; 64 return convertedEvent.modifiers;
65 } 65 }
66 66
67 TEST(WebInputEventConversionTest, WebKeyboardEventBuilder) 67 TEST(WebInputEventConversionTest, WebKeyboardEventBuilder)
68 { 68 {
69 FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings;
70
69 // Test key location conversion. 71 // Test key location conversion.
70 int modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATI ON_STANDARD); 72 int modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATI ON_STANDARD);
71 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven t::IsLeft || modifiers & WebInputEvent::IsRight); 73 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven t::IsLeft || modifiers & WebInputEvent::IsRight);
72 74
73 modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_L EFT); 75 modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_L EFT);
74 EXPECT_TRUE(modifiers & WebInputEvent::IsLeft); 76 EXPECT_TRUE(modifiers & WebInputEvent::IsLeft);
75 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven t::IsRight); 77 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven t::IsRight);
76 78
77 modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_R IGHT); 79 modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_R IGHT);
78 EXPECT_TRUE(modifiers & WebInputEvent::IsRight); 80 EXPECT_TRUE(modifiers & WebInputEvent::IsRight);
79 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven t::IsLeft); 81 EXPECT_FALSE(modifiers & WebInputEvent::IsKeyPad || modifiers & WebInputEven t::IsLeft);
80 82
81 modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_N UMPAD); 83 modifiers = getModifiersForKeyLocationCode(KeyboardEvent::DOM_KEY_LOCATION_N UMPAD);
82 EXPECT_TRUE(modifiers & WebInputEvent::IsKeyPad); 84 EXPECT_TRUE(modifiers & WebInputEvent::IsKeyPad);
83 EXPECT_FALSE(modifiers & WebInputEvent::IsLeft || modifiers & WebInputEvent: :IsRight); 85 EXPECT_FALSE(modifiers & WebInputEvent::IsLeft || modifiers & WebInputEvent: :IsRight);
84 } 86 }
85 87
86 TEST(WebInputEventConversionTest, WebMouseEventBuilder) 88 TEST(WebInputEventConversionTest, WebMouseEventBuilder)
87 { 89 {
90 FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings;
91
88 RefPtrWillBeRawPtr<TouchEvent> event = TouchEvent::create(); 92 RefPtrWillBeRawPtr<TouchEvent> event = TouchEvent::create();
89 WebMouseEventBuilder mouse(0, 0, *event); 93 WebMouseEventBuilder mouse(0, 0, *event);
90 EXPECT_EQ(WebInputEvent::Undefined, mouse.type); 94 EXPECT_EQ(WebInputEvent::Undefined, mouse.type);
91 } 95 }
92 96
93 TEST(WebInputEventConversionTest, WebTouchEventBuilder) 97 TEST(WebInputEventConversionTest, WebTouchEventBuilder)
94 { 98 {
99 FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings;
100
95 const std::string baseURL("http://www.test0.com/"); 101 const std::string baseURL("http://www.test0.com/");
96 const std::string fileName("fixed_layout.html"); 102 const std::string fileName("fixed_layout.html");
97 103
98 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html")); 104 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html"));
99 FrameTestHelpers::WebViewHelper webViewHelper; 105 FrameTestHelpers::WebViewHelper webViewHelper;
100 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); 106 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true);
101 int pageWidth = 640; 107 int pageWidth = 640;
102 int pageHeight = 480; 108 int pageHeight = 480;
103 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 109 webViewImpl->resize(WebSize(pageWidth, pageHeight));
104 webViewImpl->layout(); 110 webViewImpl->layout();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 229 }
224 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList .get(), touchList.get(), touchList.get(), EventTypeNames::touchstart, domWindow, PlatformEvent::NoModifiers, false, false); 230 RefPtrWillBeRawPtr<TouchEvent> touchEvent = TouchEvent::create(touchList .get(), touchList.get(), touchList.get(), EventTypeNames::touchstart, domWindow, PlatformEvent::NoModifiers, false, false);
225 231
226 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent); 232 WebTouchEventBuilder webTouchBuilder(documentLayoutView, *touchEvent);
227 ASSERT_EQ(static_cast<unsigned>(WebTouchEvent::touchesLengthCap), webTou chBuilder.touchesLength); 233 ASSERT_EQ(static_cast<unsigned>(WebTouchEvent::touchesLengthCap), webTou chBuilder.touchesLength);
228 } 234 }
229 } 235 }
230 236
231 TEST(WebInputEventConversionTest, InputEventsScaling) 237 TEST(WebInputEventConversionTest, InputEventsScaling)
232 { 238 {
239 FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings;
240
233 const std::string baseURL("http://www.test1.com/"); 241 const std::string baseURL("http://www.test1.com/");
234 const std::string fileName("fixed_layout.html"); 242 const std::string fileName("fixed_layout.html");
235 243
236 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html")); 244 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html"));
237 FrameTestHelpers::WebViewHelper webViewHelper; 245 FrameTestHelpers::WebViewHelper webViewHelper;
238 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); 246 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true);
239 webViewImpl->settings()->setViewportEnabled(true); 247 webViewImpl->settings()->setViewportEnabled(true);
240 int pageWidth = 640; 248 int pageWidth = 640;
241 int pageHeight = 480; 249 int pageHeight = 480;
242 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 250 webViewImpl->resize(WebSize(pageWidth, pageHeight));
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 EXPECT_FLOAT_EQ(3.5, webTouchBuilder.touches[0].position.x); 485 EXPECT_FLOAT_EQ(3.5, webTouchBuilder.touches[0].position.x);
478 EXPECT_FLOAT_EQ(2, webTouchBuilder.touches[0].position.y); 486 EXPECT_FLOAT_EQ(2, webTouchBuilder.touches[0].position.y);
479 EXPECT_FLOAT_EQ(4, webTouchBuilder.touches[0].radiusX); 487 EXPECT_FLOAT_EQ(4, webTouchBuilder.touches[0].radiusX);
480 EXPECT_FLOAT_EQ(4.5, webTouchBuilder.touches[0].radiusY); 488 EXPECT_FLOAT_EQ(4.5, webTouchBuilder.touches[0].radiusY);
481 EXPECT_FALSE(webTouchBuilder.cancelable); 489 EXPECT_FALSE(webTouchBuilder.cancelable);
482 } 490 }
483 } 491 }
484 492
485 TEST(WebInputEventConversionTest, InputEventsTransform) 493 TEST(WebInputEventConversionTest, InputEventsTransform)
486 { 494 {
495 FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings;
496
487 const std::string baseURL("http://www.test2.com/"); 497 const std::string baseURL("http://www.test2.com/");
488 const std::string fileName("fixed_layout.html"); 498 const std::string fileName("fixed_layout.html");
489 499
490 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html")); 500 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html"));
491 FrameTestHelpers::WebViewHelper webViewHelper; 501 FrameTestHelpers::WebViewHelper webViewHelper;
492 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); 502 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true);
493 webViewImpl->settings()->setViewportEnabled(true); 503 webViewImpl->settings()->setViewportEnabled(true);
494 int pageWidth = 640; 504 int pageWidth = 640;
495 int pageHeight = 480; 505 int pageHeight = 480;
496 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 506 webViewImpl->resize(WebSize(pageWidth, pageHeight));
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 EXPECT_EQ(webGestureEvent.x, recreatedWebGestureEvent.x); 689 EXPECT_EQ(webGestureEvent.x, recreatedWebGestureEvent.x);
680 EXPECT_EQ(webGestureEvent.y, recreatedWebGestureEvent.y); 690 EXPECT_EQ(webGestureEvent.y, recreatedWebGestureEvent.y);
681 EXPECT_EQ(webGestureEvent.globalX, recreatedWebGestureEvent.globalX); 691 EXPECT_EQ(webGestureEvent.globalX, recreatedWebGestureEvent.globalX);
682 EXPECT_EQ(webGestureEvent.globalY, recreatedWebGestureEvent.globalY); 692 EXPECT_EQ(webGestureEvent.globalY, recreatedWebGestureEvent.globalY);
683 EXPECT_EQ(webGestureEvent.data.tap.tapCount, recreatedWebGestureEvent.da ta.tap.tapCount); 693 EXPECT_EQ(webGestureEvent.data.tap.tapCount, recreatedWebGestureEvent.da ta.tap.tapCount);
684 } 694 }
685 } 695 }
686 696
687 TEST(WebInputEventConversionTest, VisualViewportOffset) 697 TEST(WebInputEventConversionTest, VisualViewportOffset)
688 { 698 {
699 FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings;
700
689 const std::string baseURL("http://www.test4.com/"); 701 const std::string baseURL("http://www.test4.com/");
690 const std::string fileName("fixed_layout.html"); 702 const std::string fileName("fixed_layout.html");
691 703
692 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html")); 704 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html"));
693 FrameTestHelpers::WebViewHelper webViewHelper; 705 FrameTestHelpers::WebViewHelper webViewHelper;
694 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); 706 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true);
695 int pageWidth = 640; 707 int pageWidth = 640;
696 int pageHeight = 480; 708 int pageHeight = 480;
697 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 709 webViewImpl->resize(WebSize(pageWidth, pageHeight));
698 webViewImpl->layout(); 710 webViewImpl->layout();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 PlatformTouchEventBuilder platformTouchBuilder(view, webTouchEvent); 784 PlatformTouchEventBuilder platformTouchBuilder(view, webTouchEvent);
773 EXPECT_FLOAT_EQ(10.6f, platformTouchBuilder.touchPoints()[0].screenPos() .x()); 785 EXPECT_FLOAT_EQ(10.6f, platformTouchBuilder.touchPoints()[0].screenPos() .x());
774 EXPECT_FLOAT_EQ(10.4f, platformTouchBuilder.touchPoints()[0].screenPos() .y()); 786 EXPECT_FLOAT_EQ(10.4f, platformTouchBuilder.touchPoints()[0].screenPos() .y());
775 EXPECT_FLOAT_EQ(5.3f + visualOffset.x(), platformTouchBuilder.touchPoint s()[0].pos().x()); 787 EXPECT_FLOAT_EQ(5.3f + visualOffset.x(), platformTouchBuilder.touchPoint s()[0].pos().x());
776 EXPECT_FLOAT_EQ(5.2f + visualOffset.y(), platformTouchBuilder.touchPoint s()[0].pos().y()); 788 EXPECT_FLOAT_EQ(5.2f + visualOffset.y(), platformTouchBuilder.touchPoint s()[0].pos().y());
777 } 789 }
778 } 790 }
779 791
780 TEST(WebInputEventConversionTest, ElasticOverscroll) 792 TEST(WebInputEventConversionTest, ElasticOverscroll)
781 { 793 {
794 FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings;
795
782 const std::string baseURL("http://www.test5.com/"); 796 const std::string baseURL("http://www.test5.com/");
783 const std::string fileName("fixed_layout.html"); 797 const std::string fileName("fixed_layout.html");
784 798
785 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html")); 799 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html"));
786 FrameTestHelpers::WebViewHelper webViewHelper; 800 FrameTestHelpers::WebViewHelper webViewHelper;
787 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); 801 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true);
788 int pageWidth = 640; 802 int pageWidth = 640;
789 int pageHeight = 480; 803 int pageHeight = 480;
790 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 804 webViewImpl->resize(WebSize(pageWidth, pageHeight));
791 webViewImpl->layout(); 805 webViewImpl->layout();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 EXPECT_EQ(webMouseEvent.x / pageScale + visualOffset.x() + elasticOversc roll.width(), platformMouseBuilder.position().x()); 848 EXPECT_EQ(webMouseEvent.x / pageScale + visualOffset.x() + elasticOversc roll.width(), platformMouseBuilder.position().x());
835 EXPECT_EQ(webMouseEvent.y / pageScale + visualOffset.y() + elasticOversc roll.height(), platformMouseBuilder.position().y()); 849 EXPECT_EQ(webMouseEvent.y / pageScale + visualOffset.y() + elasticOversc roll.height(), platformMouseBuilder.position().y());
836 EXPECT_EQ(webMouseEvent.globalX, platformMouseBuilder.globalPosition().x ()); 850 EXPECT_EQ(webMouseEvent.globalX, platformMouseBuilder.globalPosition().x ());
837 EXPECT_EQ(webMouseEvent.globalY, platformMouseBuilder.globalPosition().y ()); 851 EXPECT_EQ(webMouseEvent.globalY, platformMouseBuilder.globalPosition().y ());
838 } 852 }
839 } 853 }
840 854
841 // Page reload/navigation should not reset elastic overscroll. 855 // Page reload/navigation should not reset elastic overscroll.
842 TEST(WebInputEventConversionTest, ElasticOverscrollWithPageReload) 856 TEST(WebInputEventConversionTest, ElasticOverscrollWithPageReload)
843 { 857 {
858 FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings;
859
844 const std::string baseURL("http://www.test6.com/"); 860 const std::string baseURL("http://www.test6.com/");
845 const std::string fileName("fixed_layout.html"); 861 const std::string fileName("fixed_layout.html");
846 862
847 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html")); 863 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html"));
848 FrameTestHelpers::WebViewHelper webViewHelper; 864 FrameTestHelpers::WebViewHelper webViewHelper;
849 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); 865 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true);
850 int pageWidth = 640; 866 int pageWidth = 640;
851 int pageHeight = 480; 867 int pageHeight = 480;
852 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 868 webViewImpl->resize(WebSize(pageWidth, pageHeight));
853 webViewImpl->layout(); 869 webViewImpl->layout();
(...skipping 17 matching lines...) Expand all
871 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); 887 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent);
872 EXPECT_EQ(webMouseEvent.x + elasticOverscroll.width(), platformMouseBuil der.position().x()); 888 EXPECT_EQ(webMouseEvent.x + elasticOverscroll.width(), platformMouseBuil der.position().x());
873 EXPECT_EQ(webMouseEvent.y + elasticOverscroll.height(), platformMouseBui lder.position().y()); 889 EXPECT_EQ(webMouseEvent.y + elasticOverscroll.height(), platformMouseBui lder.position().y());
874 EXPECT_EQ(webMouseEvent.globalX, platformMouseBuilder.globalPosition().x ()); 890 EXPECT_EQ(webMouseEvent.globalX, platformMouseBuilder.globalPosition().x ());
875 EXPECT_EQ(webMouseEvent.globalY, platformMouseBuilder.globalPosition().y ()); 891 EXPECT_EQ(webMouseEvent.globalY, platformMouseBuilder.globalPosition().y ());
876 } 892 }
877 } 893 }
878 894
879 TEST(WebInputEventConversionTest, WebMouseWheelEventBuilder) 895 TEST(WebInputEventConversionTest, WebMouseWheelEventBuilder)
880 { 896 {
897 FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings;
898
881 const std::string baseURL("http://www.test7.com/"); 899 const std::string baseURL("http://www.test7.com/");
882 const std::string fileName("fixed_layout.html"); 900 const std::string fileName("fixed_layout.html");
883 901
884 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html")); 902 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html"));
885 FrameTestHelpers::WebViewHelper webViewHelper; 903 FrameTestHelpers::WebViewHelper webViewHelper;
886 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); 904 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true);
887 int pageWidth = 640; 905 int pageWidth = 640;
888 int pageHeight = 480; 906 int pageHeight = 480;
889 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 907 webViewImpl->resize(WebSize(pageWidth, pageHeight));
890 webViewImpl->layout(); 908 webViewImpl->layout();
(...skipping 12 matching lines...) Expand all
903 EXPECT_EQ(10, webMouseWheel.windowX); 921 EXPECT_EQ(10, webMouseWheel.windowX);
904 EXPECT_EQ(30, webMouseWheel.windowY); 922 EXPECT_EQ(30, webMouseWheel.windowY);
905 EXPECT_TRUE(webMouseWheel.scrollByPage); 923 EXPECT_TRUE(webMouseWheel.scrollByPage);
906 EXPECT_EQ(WebInputEvent::ControlKey, webMouseWheel.modifiers); 924 EXPECT_EQ(WebInputEvent::ControlKey, webMouseWheel.modifiers);
907 EXPECT_TRUE(webMouseWheel.canScroll); 925 EXPECT_TRUE(webMouseWheel.canScroll);
908 EXPECT_EQ(WebInputEvent::RailsModeHorizontal, webMouseWheel.railsMode); 926 EXPECT_EQ(WebInputEvent::RailsModeHorizontal, webMouseWheel.railsMode);
909 } 927 }
910 928
911 TEST(WebInputEventConversionTest, PlatformWheelEventBuilder) 929 TEST(WebInputEventConversionTest, PlatformWheelEventBuilder)
912 { 930 {
931 FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings;
932
913 const std::string baseURL("http://www.test8.com/"); 933 const std::string baseURL("http://www.test8.com/");
914 const std::string fileName("fixed_layout.html"); 934 const std::string fileName("fixed_layout.html");
915 935
916 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html")); 936 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s tr()), WebString::fromUTF8("fixed_layout.html"));
917 FrameTestHelpers::WebViewHelper webViewHelper; 937 FrameTestHelpers::WebViewHelper webViewHelper;
918 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true); 938 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam e, true);
919 int pageWidth = 640; 939 int pageWidth = 640;
920 int pageHeight = 480; 940 int pageHeight = 480;
921 webViewImpl->resize(WebSize(pageWidth, pageHeight)); 941 webViewImpl->resize(WebSize(pageWidth, pageHeight));
922 webViewImpl->layout(); 942 webViewImpl->layout();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 EXPECT_EQ(15, platformWheelBuilder.deltaX()); 1007 EXPECT_EQ(15, platformWheelBuilder.deltaX());
988 EXPECT_EQ(10, platformWheelBuilder.deltaY()); 1008 EXPECT_EQ(10, platformWheelBuilder.deltaY());
989 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.modifiers()); 1009 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.modifiers());
990 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); 1010 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas());
991 EXPECT_FALSE(platformWheelBuilder.canScroll()); 1011 EXPECT_FALSE(platformWheelBuilder.canScroll());
992 EXPECT_EQ(platformWheelBuilder.railsMode(), PlatformEvent::RailsModeVert ical); 1012 EXPECT_EQ(platformWheelBuilder.railsMode(), PlatformEvent::RailsModeVert ical);
993 } 1013 }
994 } 1014 }
995 1015
996 } // namespace blink 1016 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698