| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 5865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5876 EXPECT_GE(targetRects.size(), 2u); | 5876 EXPECT_GE(targetRects.size(), 2u); |
| 5877 m_triggered = true; | 5877 m_triggered = true; |
| 5878 return true; | 5878 return true; |
| 5879 } | 5879 } |
| 5880 | 5880 |
| 5881 bool triggered() const { return m_triggered; } | 5881 bool triggered() const { return m_triggered; } |
| 5882 void resetTriggered() { m_triggered = false; } | 5882 void resetTriggered() { m_triggered = false; } |
| 5883 bool m_triggered; | 5883 bool m_triggered; |
| 5884 }; | 5884 }; |
| 5885 | 5885 |
| 5886 static WebGestureEvent fatTap(int x, int y) { | 5886 static WebCoalescedInputEvent fatTap(int x, int y) { |
| 5887 WebGestureEvent event(WebInputEvent::GestureTap, WebInputEvent::NoModifiers, | 5887 WebGestureEvent event(WebInputEvent::GestureTap, WebInputEvent::NoModifiers, |
| 5888 WebInputEvent::TimeStampForTesting); | 5888 WebInputEvent::TimeStampForTesting); |
| 5889 event.sourceDevice = WebGestureDeviceTouchscreen; | 5889 event.sourceDevice = WebGestureDeviceTouchscreen; |
| 5890 event.x = x; | 5890 event.x = x; |
| 5891 event.y = y; | 5891 event.y = y; |
| 5892 event.data.tap.width = 50; | 5892 event.data.tap.width = 50; |
| 5893 event.data.tap.height = 50; | 5893 event.data.tap.height = 50; |
| 5894 return event; | 5894 return WebCoalescedInputEvent(event); |
| 5895 } | 5895 } |
| 5896 | 5896 |
| 5897 TEST_P(ParameterizedWebFrameTest, DisambiguationPopup) { | 5897 TEST_P(ParameterizedWebFrameTest, DisambiguationPopup) { |
| 5898 const std::string htmlFile = "disambiguation_popup.html"; | 5898 const std::string htmlFile = "disambiguation_popup.html"; |
| 5899 registerMockedHttpURLLoad(htmlFile); | 5899 registerMockedHttpURLLoad(htmlFile); |
| 5900 | 5900 |
| 5901 DisambiguationPopupTestWebViewClient client; | 5901 DisambiguationPopupTestWebViewClient client; |
| 5902 | 5902 |
| 5903 // Make sure we initialize to minimum scale, even if the window size | 5903 // Make sure we initialize to minimum scale, even if the window size |
| 5904 // only becomes available after the load begins. | 5904 // only becomes available after the load begins. |
| (...skipping 3818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9723 void(const WebFloatSize&, | 9723 void(const WebFloatSize&, |
| 9724 const WebFloatSize&, | 9724 const WebFloatSize&, |
| 9725 const WebFloatPoint&, | 9725 const WebFloatPoint&, |
| 9726 const WebFloatSize&)); | 9726 const WebFloatSize&)); |
| 9727 }; | 9727 }; |
| 9728 | 9728 |
| 9729 class WebFrameOverscrollTest | 9729 class WebFrameOverscrollTest |
| 9730 : public WebFrameTest, | 9730 : public WebFrameTest, |
| 9731 public ::testing::WithParamInterface<blink::WebGestureDevice> { | 9731 public ::testing::WithParamInterface<blink::WebGestureDevice> { |
| 9732 protected: | 9732 protected: |
| 9733 WebGestureEvent generateEvent(WebInputEvent::Type type, | 9733 WebCoalescedInputEvent generateEvent(WebInputEvent::Type type, |
| 9734 float deltaX = 0.0, | 9734 float deltaX = 0.0, |
| 9735 float deltaY = 0.0) { | 9735 float deltaY = 0.0) { |
| 9736 WebGestureEvent event(type, WebInputEvent::NoModifiers, | 9736 WebGestureEvent event(type, WebInputEvent::NoModifiers, |
| 9737 WebInputEvent::TimeStampForTesting); | 9737 WebInputEvent::TimeStampForTesting); |
| 9738 // TODO(wjmaclean): Make sure that touchpad device is only ever used for | 9738 // TODO(wjmaclean): Make sure that touchpad device is only ever used for |
| 9739 // gesture scrolling event types. | 9739 // gesture scrolling event types. |
| 9740 event.sourceDevice = GetParam(); | 9740 event.sourceDevice = GetParam(); |
| 9741 event.x = 100; | 9741 event.x = 100; |
| 9742 event.y = 100; | 9742 event.y = 100; |
| 9743 if (type == WebInputEvent::GestureScrollUpdate) { | 9743 if (type == WebInputEvent::GestureScrollUpdate) { |
| 9744 event.data.scrollUpdate.deltaX = deltaX; | 9744 event.data.scrollUpdate.deltaX = deltaX; |
| 9745 event.data.scrollUpdate.deltaY = deltaY; | 9745 event.data.scrollUpdate.deltaY = deltaY; |
| 9746 } | 9746 } |
| 9747 return event; | 9747 return WebCoalescedInputEvent(event); |
| 9748 } | 9748 } |
| 9749 | 9749 |
| 9750 void ScrollBegin(FrameTestHelpers::WebViewHelper* webViewHelper) { | 9750 void ScrollBegin(FrameTestHelpers::WebViewHelper* webViewHelper) { |
| 9751 webViewHelper->webView()->handleInputEvent( | 9751 webViewHelper->webView()->handleInputEvent( |
| 9752 generateEvent(WebInputEvent::GestureScrollBegin)); | 9752 generateEvent(WebInputEvent::GestureScrollBegin)); |
| 9753 } | 9753 } |
| 9754 | 9754 |
| 9755 void ScrollUpdate(FrameTestHelpers::WebViewHelper* webViewHelper, | 9755 void ScrollUpdate(FrameTestHelpers::WebViewHelper* webViewHelper, |
| 9756 float deltaX, | 9756 float deltaX, |
| 9757 float deltaY) { | 9757 float deltaY) { |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10681 WebInputEvent::NoModifiers, | 10681 WebInputEvent::NoModifiers, |
| 10682 WebInputEvent::TimeStampForTesting); | 10682 WebInputEvent::TimeStampForTesting); |
| 10683 updateEvent.sourceDevice = WebGestureDeviceTouchpad; | 10683 updateEvent.sourceDevice = WebGestureDeviceTouchpad; |
| 10684 WebGestureEvent endEvent(WebInputEvent::GestureScrollEnd, | 10684 WebGestureEvent endEvent(WebInputEvent::GestureScrollEnd, |
| 10685 WebInputEvent::NoModifiers, | 10685 WebInputEvent::NoModifiers, |
| 10686 WebInputEvent::TimeStampForTesting); | 10686 WebInputEvent::TimeStampForTesting); |
| 10687 endEvent.sourceDevice = WebGestureDeviceTouchpad; | 10687 endEvent.sourceDevice = WebGestureDeviceTouchpad; |
| 10688 | 10688 |
| 10689 // Try GestureScrollEnd and GestureScrollUpdate first to make sure that not | 10689 // Try GestureScrollEnd and GestureScrollUpdate first to make sure that not |
| 10690 // seeing a Begin first doesn't break anything. (This currently happens). | 10690 // seeing a Begin first doesn't break anything. (This currently happens). |
| 10691 webViewHelper.webView()->handleInputEvent(endEvent); | 10691 webViewHelper.webView()->handleInputEvent(WebCoalescedInputEvent(endEvent)); |
| 10692 webViewHelper.webView()->handleInputEvent(updateEvent); | 10692 webViewHelper.webView()->handleInputEvent( |
| 10693 WebCoalescedInputEvent(updateEvent)); |
| 10693 | 10694 |
| 10694 // Try a full Begin/Update/End cycle. | 10695 // Try a full Begin/Update/End cycle. |
| 10695 webViewHelper.webView()->handleInputEvent(beginEvent); | 10696 webViewHelper.webView()->handleInputEvent(WebCoalescedInputEvent(beginEvent)); |
| 10696 webViewHelper.webView()->handleInputEvent(updateEvent); | 10697 webViewHelper.webView()->handleInputEvent( |
| 10697 webViewHelper.webView()->handleInputEvent(endEvent); | 10698 WebCoalescedInputEvent(updateEvent)); |
| 10699 webViewHelper.webView()->handleInputEvent(WebCoalescedInputEvent(endEvent)); |
| 10698 } | 10700 } |
| 10699 | 10701 |
| 10700 TEST_F(WebFrameTest, HidingScrollbarsOnScrollableAreaDisablesScrollbars) { | 10702 TEST_F(WebFrameTest, HidingScrollbarsOnScrollableAreaDisablesScrollbars) { |
| 10701 FrameTestHelpers::WebViewHelper webViewHelper; | 10703 FrameTestHelpers::WebViewHelper webViewHelper; |
| 10702 webViewHelper.initialize(true); | 10704 webViewHelper.initialize(true); |
| 10703 webViewHelper.resize(WebSize(800, 600)); | 10705 webViewHelper.resize(WebSize(800, 600)); |
| 10704 WebViewImpl* webView = webViewHelper.webView(); | 10706 WebViewImpl* webView = webViewHelper.webView(); |
| 10705 | 10707 |
| 10706 initializeWithHTML( | 10708 initializeWithHTML( |
| 10707 *webView->mainFrameImpl()->frame(), | 10709 *webView->mainFrameImpl()->frame(), |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11236 | 11238 |
| 11237 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); | 11239 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); |
| 11238 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); | 11240 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); |
| 11239 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); | 11241 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); |
| 11240 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); | 11242 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); |
| 11241 | 11243 |
| 11242 webViewHelper.reset(); | 11244 webViewHelper.reset(); |
| 11243 } | 11245 } |
| 11244 | 11246 |
| 11245 } // namespace blink | 11247 } // namespace blink |
| OLD | NEW |