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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 EXPECT_EQ(webMouseEvent.x / pageScale + visualOffset.x() + elasticOversc
roll.width(), platformMouseBuilder.position().x()); | 816 EXPECT_EQ(webMouseEvent.x / pageScale + visualOffset.x() + elasticOversc
roll.width(), platformMouseBuilder.position().x()); |
817 EXPECT_EQ(webMouseEvent.y / pageScale + visualOffset.y() + elasticOversc
roll.height(), platformMouseBuilder.position().y()); | 817 EXPECT_EQ(webMouseEvent.y / pageScale + visualOffset.y() + elasticOversc
roll.height(), platformMouseBuilder.position().y()); |
818 EXPECT_EQ(webMouseEvent.globalX, platformMouseBuilder.globalPosition().x
()); | 818 EXPECT_EQ(webMouseEvent.globalX, platformMouseBuilder.globalPosition().x
()); |
819 EXPECT_EQ(webMouseEvent.globalY, platformMouseBuilder.globalPosition().y
()); | 819 EXPECT_EQ(webMouseEvent.globalY, platformMouseBuilder.globalPosition().y
()); |
820 } | 820 } |
821 } | 821 } |
822 | 822 |
823 // Page reload/navigation should not reset elastic overscroll. | 823 // Page reload/navigation should not reset elastic overscroll. |
824 TEST(WebInputEventConversionTest, ElasticOverscrollWithPageReload) | 824 TEST(WebInputEventConversionTest, ElasticOverscrollWithPageReload) |
825 { | 825 { |
826 const std::string baseURL("http://www.test5.com/"); | 826 const std::string baseURL("http://www.test6.com/"); |
827 const std::string fileName("fixed_layout.html"); | 827 const std::string fileName("fixed_layout.html"); |
828 | 828 |
829 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); | 829 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); |
830 FrameTestHelpers::WebViewHelper webViewHelper; | 830 FrameTestHelpers::WebViewHelper webViewHelper; |
831 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true); | 831 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true); |
832 int pageWidth = 640; | 832 int pageWidth = 640; |
833 int pageHeight = 480; | 833 int pageHeight = 480; |
834 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 834 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
835 webViewImpl->layout(); | 835 webViewImpl->layout(); |
836 | 836 |
(...skipping 16 matching lines...) Expand all Loading... |
853 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); | 853 PlatformMouseEventBuilder platformMouseBuilder(view, webMouseEvent); |
854 EXPECT_EQ(webMouseEvent.x + elasticOverscroll.width(), platformMouseBuil
der.position().x()); | 854 EXPECT_EQ(webMouseEvent.x + elasticOverscroll.width(), platformMouseBuil
der.position().x()); |
855 EXPECT_EQ(webMouseEvent.y + elasticOverscroll.height(), platformMouseBui
lder.position().y()); | 855 EXPECT_EQ(webMouseEvent.y + elasticOverscroll.height(), platformMouseBui
lder.position().y()); |
856 EXPECT_EQ(webMouseEvent.globalX, platformMouseBuilder.globalPosition().x
()); | 856 EXPECT_EQ(webMouseEvent.globalX, platformMouseBuilder.globalPosition().x
()); |
857 EXPECT_EQ(webMouseEvent.globalY, platformMouseBuilder.globalPosition().y
()); | 857 EXPECT_EQ(webMouseEvent.globalY, platformMouseBuilder.globalPosition().y
()); |
858 } | 858 } |
859 } | 859 } |
860 | 860 |
861 TEST(WebInputEventConversionTest, WebMouseWheelEventBuilder) | 861 TEST(WebInputEventConversionTest, WebMouseWheelEventBuilder) |
862 { | 862 { |
863 const std::string baseURL("http://www.test6.com/"); | 863 const std::string baseURL("http://www.test7.com/"); |
864 const std::string fileName("fixed_layout.html"); | 864 const std::string fileName("fixed_layout.html"); |
865 | 865 |
866 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); | 866 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_s
tr()), WebString::fromUTF8("fixed_layout.html")); |
867 FrameTestHelpers::WebViewHelper webViewHelper; | 867 FrameTestHelpers::WebViewHelper webViewHelper; |
868 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true); | 868 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(baseURL + fileNam
e, true); |
869 int pageWidth = 640; | 869 int pageWidth = 640; |
870 int pageHeight = 480; | 870 int pageHeight = 480; |
871 webViewImpl->resize(WebSize(pageWidth, pageHeight)); | 871 webViewImpl->resize(WebSize(pageWidth, pageHeight)); |
872 webViewImpl->layout(); | 872 webViewImpl->layout(); |
873 | 873 |
(...skipping 11 matching lines...) Expand all Loading... |
885 EXPECT_EQ(10, webMouseWheel.windowX); | 885 EXPECT_EQ(10, webMouseWheel.windowX); |
886 EXPECT_EQ(30, webMouseWheel.windowY); | 886 EXPECT_EQ(30, webMouseWheel.windowY); |
887 EXPECT_TRUE(webMouseWheel.scrollByPage); | 887 EXPECT_TRUE(webMouseWheel.scrollByPage); |
888 EXPECT_EQ(WebInputEvent::ControlKey, webMouseWheel.modifiers); | 888 EXPECT_EQ(WebInputEvent::ControlKey, webMouseWheel.modifiers); |
889 EXPECT_TRUE(webMouseWheel.canScroll); | 889 EXPECT_TRUE(webMouseWheel.canScroll); |
890 EXPECT_EQ(WebInputEvent::RailsModeHorizontal, webMouseWheel.railsMode); | 890 EXPECT_EQ(WebInputEvent::RailsModeHorizontal, webMouseWheel.railsMode); |
891 } | 891 } |
892 | 892 |
893 TEST(WebInputEventConversionTest, PlatformWheelEventBuilder) | 893 TEST(WebInputEventConversionTest, PlatformWheelEventBuilder) |
894 { | 894 { |
895 const std::string baseURL("http://www.test7.com/"); | 895 const std::string baseURL("http://www.test8.com/"); |
896 const std::string fileName("fixed_layout.html"); | 896 const std::string fileName("fixed_layout.html"); |
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->layout(); | 904 webViewImpl->layout(); |
905 | 905 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 EXPECT_EQ(15, platformWheelBuilder.deltaX()); | 969 EXPECT_EQ(15, platformWheelBuilder.deltaX()); |
970 EXPECT_EQ(10, platformWheelBuilder.deltaY()); | 970 EXPECT_EQ(10, platformWheelBuilder.deltaY()); |
971 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.modifiers()); | 971 EXPECT_EQ(PlatformEvent::AltKey, platformWheelBuilder.modifiers()); |
972 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); | 972 EXPECT_TRUE(platformWheelBuilder.hasPreciseScrollingDeltas()); |
973 EXPECT_FALSE(platformWheelBuilder.canScroll()); | 973 EXPECT_FALSE(platformWheelBuilder.canScroll()); |
974 EXPECT_EQ(platformWheelBuilder.railsMode(), PlatformEvent::RailsModeVert
ical); | 974 EXPECT_EQ(platformWheelBuilder.railsMode(), PlatformEvent::RailsModeVert
ical); |
975 } | 975 } |
976 } | 976 } |
977 | 977 |
978 } // namespace blink | 978 } // namespace blink |
OLD | NEW |