| 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 5828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5839 EXPECT_GE(targetRects.size(), 2u); | 5839 EXPECT_GE(targetRects.size(), 2u); |
| 5840 m_triggered = true; | 5840 m_triggered = true; |
| 5841 return true; | 5841 return true; |
| 5842 } | 5842 } |
| 5843 | 5843 |
| 5844 bool triggered() const { return m_triggered; } | 5844 bool triggered() const { return m_triggered; } |
| 5845 void resetTriggered() { m_triggered = false; } | 5845 void resetTriggered() { m_triggered = false; } |
| 5846 bool m_triggered; | 5846 bool m_triggered; |
| 5847 }; | 5847 }; |
| 5848 | 5848 |
| 5849 static WebGestureEvent fatTap(int x, int y) { | 5849 static WebCoalescedInputEvent fatTap(int x, int y) { |
| 5850 WebGestureEvent event(WebInputEvent::GestureTap, WebInputEvent::NoModifiers, | 5850 WebGestureEvent event(WebInputEvent::GestureTap, WebInputEvent::NoModifiers, |
| 5851 WebInputEvent::TimeStampForTesting); | 5851 WebInputEvent::TimeStampForTesting); |
| 5852 event.sourceDevice = WebGestureDeviceTouchscreen; | 5852 event.sourceDevice = WebGestureDeviceTouchscreen; |
| 5853 event.x = x; | 5853 event.x = x; |
| 5854 event.y = y; | 5854 event.y = y; |
| 5855 event.data.tap.width = 50; | 5855 event.data.tap.width = 50; |
| 5856 event.data.tap.height = 50; | 5856 event.data.tap.height = 50; |
| 5857 return event; | 5857 return WebCoalescedInputEvent(event); |
| 5858 } | 5858 } |
| 5859 | 5859 |
| 5860 TEST_P(ParameterizedWebFrameTest, DisambiguationPopup) { | 5860 TEST_P(ParameterizedWebFrameTest, DisambiguationPopup) { |
| 5861 const std::string htmlFile = "disambiguation_popup.html"; | 5861 const std::string htmlFile = "disambiguation_popup.html"; |
| 5862 registerMockedHttpURLLoad(htmlFile); | 5862 registerMockedHttpURLLoad(htmlFile); |
| 5863 | 5863 |
| 5864 DisambiguationPopupTestWebViewClient client; | 5864 DisambiguationPopupTestWebViewClient client; |
| 5865 | 5865 |
| 5866 // Make sure we initialize to minimum scale, even if the window size | 5866 // Make sure we initialize to minimum scale, even if the window size |
| 5867 // only becomes available after the load begins. | 5867 // only becomes available after the load begins. |
| (...skipping 3851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9719 void(const WebFloatSize&, | 9719 void(const WebFloatSize&, |
| 9720 const WebFloatSize&, | 9720 const WebFloatSize&, |
| 9721 const WebFloatPoint&, | 9721 const WebFloatPoint&, |
| 9722 const WebFloatSize&)); | 9722 const WebFloatSize&)); |
| 9723 }; | 9723 }; |
| 9724 | 9724 |
| 9725 class WebFrameOverscrollTest | 9725 class WebFrameOverscrollTest |
| 9726 : public WebFrameTest, | 9726 : public WebFrameTest, |
| 9727 public ::testing::WithParamInterface<blink::WebGestureDevice> { | 9727 public ::testing::WithParamInterface<blink::WebGestureDevice> { |
| 9728 protected: | 9728 protected: |
| 9729 WebGestureEvent generateEvent(WebInputEvent::Type type, | 9729 WebCoalescedInputEvent generateEvent(WebInputEvent::Type type, |
| 9730 float deltaX = 0.0, | 9730 float deltaX = 0.0, |
| 9731 float deltaY = 0.0) { | 9731 float deltaY = 0.0) { |
| 9732 WebGestureEvent event(type, WebInputEvent::NoModifiers, | 9732 WebGestureEvent event(type, WebInputEvent::NoModifiers, |
| 9733 WebInputEvent::TimeStampForTesting); | 9733 WebInputEvent::TimeStampForTesting); |
| 9734 // TODO(wjmaclean): Make sure that touchpad device is only ever used for | 9734 // TODO(wjmaclean): Make sure that touchpad device is only ever used for |
| 9735 // gesture scrolling event types. | 9735 // gesture scrolling event types. |
| 9736 event.sourceDevice = GetParam(); | 9736 event.sourceDevice = GetParam(); |
| 9737 event.x = 100; | 9737 event.x = 100; |
| 9738 event.y = 100; | 9738 event.y = 100; |
| 9739 if (type == WebInputEvent::GestureScrollUpdate) { | 9739 if (type == WebInputEvent::GestureScrollUpdate) { |
| 9740 event.data.scrollUpdate.deltaX = deltaX; | 9740 event.data.scrollUpdate.deltaX = deltaX; |
| 9741 event.data.scrollUpdate.deltaY = deltaY; | 9741 event.data.scrollUpdate.deltaY = deltaY; |
| 9742 } | 9742 } |
| 9743 return event; | 9743 return WebCoalescedInputEvent(event); |
| 9744 } | 9744 } |
| 9745 | 9745 |
| 9746 void ScrollBegin(FrameTestHelpers::WebViewHelper* webViewHelper) { | 9746 void ScrollBegin(FrameTestHelpers::WebViewHelper* webViewHelper) { |
| 9747 webViewHelper->webView()->handleInputEvent( | 9747 webViewHelper->webView()->handleInputEvent( |
| 9748 generateEvent(WebInputEvent::GestureScrollBegin)); | 9748 generateEvent(WebInputEvent::GestureScrollBegin)); |
| 9749 } | 9749 } |
| 9750 | 9750 |
| 9751 void ScrollUpdate(FrameTestHelpers::WebViewHelper* webViewHelper, | 9751 void ScrollUpdate(FrameTestHelpers::WebViewHelper* webViewHelper, |
| 9752 float deltaX, | 9752 float deltaX, |
| 9753 float deltaY) { | 9753 float deltaY) { |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10677 WebInputEvent::NoModifiers, | 10677 WebInputEvent::NoModifiers, |
| 10678 WebInputEvent::TimeStampForTesting); | 10678 WebInputEvent::TimeStampForTesting); |
| 10679 updateEvent.sourceDevice = WebGestureDeviceTouchpad; | 10679 updateEvent.sourceDevice = WebGestureDeviceTouchpad; |
| 10680 WebGestureEvent endEvent(WebInputEvent::GestureScrollEnd, | 10680 WebGestureEvent endEvent(WebInputEvent::GestureScrollEnd, |
| 10681 WebInputEvent::NoModifiers, | 10681 WebInputEvent::NoModifiers, |
| 10682 WebInputEvent::TimeStampForTesting); | 10682 WebInputEvent::TimeStampForTesting); |
| 10683 endEvent.sourceDevice = WebGestureDeviceTouchpad; | 10683 endEvent.sourceDevice = WebGestureDeviceTouchpad; |
| 10684 | 10684 |
| 10685 // Try GestureScrollEnd and GestureScrollUpdate first to make sure that not | 10685 // Try GestureScrollEnd and GestureScrollUpdate first to make sure that not |
| 10686 // seeing a Begin first doesn't break anything. (This currently happens). | 10686 // seeing a Begin first doesn't break anything. (This currently happens). |
| 10687 webViewHelper.webView()->handleInputEvent(endEvent); | 10687 webViewHelper.webView()->handleInputEvent(WebCoalescedInputEvent(endEvent)); |
| 10688 webViewHelper.webView()->handleInputEvent(updateEvent); | 10688 webViewHelper.webView()->handleInputEvent( |
| 10689 WebCoalescedInputEvent(updateEvent)); |
| 10689 | 10690 |
| 10690 // Try a full Begin/Update/End cycle. | 10691 // Try a full Begin/Update/End cycle. |
| 10691 webViewHelper.webView()->handleInputEvent(beginEvent); | 10692 webViewHelper.webView()->handleInputEvent(WebCoalescedInputEvent(beginEvent)); |
| 10692 webViewHelper.webView()->handleInputEvent(updateEvent); | 10693 webViewHelper.webView()->handleInputEvent( |
| 10693 webViewHelper.webView()->handleInputEvent(endEvent); | 10694 WebCoalescedInputEvent(updateEvent)); |
| 10695 webViewHelper.webView()->handleInputEvent(WebCoalescedInputEvent(endEvent)); |
| 10694 } | 10696 } |
| 10695 | 10697 |
| 10696 TEST_F(WebFrameTest, HidingScrollbarsOnScrollableAreaDisablesScrollbars) { | 10698 TEST_F(WebFrameTest, HidingScrollbarsOnScrollableAreaDisablesScrollbars) { |
| 10697 FrameTestHelpers::WebViewHelper webViewHelper; | 10699 FrameTestHelpers::WebViewHelper webViewHelper; |
| 10698 webViewHelper.initialize(true); | 10700 webViewHelper.initialize(true); |
| 10699 webViewHelper.resize(WebSize(800, 600)); | 10701 webViewHelper.resize(WebSize(800, 600)); |
| 10700 WebViewImpl* webView = webViewHelper.webView(); | 10702 WebViewImpl* webView = webViewHelper.webView(); |
| 10701 | 10703 |
| 10702 initializeWithHTML( | 10704 initializeWithHTML( |
| 10703 *webView->mainFrameImpl()->frame(), | 10705 *webView->mainFrameImpl()->frame(), |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11232 | 11234 |
| 11233 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); | 11235 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); |
| 11234 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); | 11236 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); |
| 11235 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); | 11237 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); |
| 11236 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); | 11238 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); |
| 11237 | 11239 |
| 11238 webViewHelper.reset(); | 11240 webViewHelper.reset(); |
| 11239 } | 11241 } |
| 11240 | 11242 |
| 11241 } // namespace blink | 11243 } // namespace blink |
| OLD | NEW |