| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1610 // Explicitly close as the frame as no frame client to do so on frameDetache
d(). | 1610 // Explicitly close as the frame as no frame client to do so on frameDetache
d(). |
| 1611 localFrame->close(); | 1611 localFrame->close(); |
| 1612 } | 1612 } |
| 1613 | 1613 |
| 1614 TEST_F(WebViewTest, LongPressEmptyDiv) | 1614 TEST_F(WebViewTest, LongPressEmptyDiv) |
| 1615 { | 1615 { |
| 1616 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), | 1616 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), |
| 1617 WebString::fromUTF8("long_press_empty_div.html")); | 1617 WebString::fromUTF8("long_press_empty_div.html")); |
| 1618 | 1618 |
| 1619 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_p
ress_empty_div.html", true); | 1619 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_p
ress_empty_div.html", true); |
| 1620 webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(false); |
| 1620 webView->resize(WebSize(500, 300)); | 1621 webView->resize(WebSize(500, 300)); |
| 1621 webView->updateAllLifecyclePhases(); | 1622 webView->updateAllLifecyclePhases(); |
| 1622 runPendingTasks(); | 1623 runPendingTasks(); |
| 1623 | 1624 |
| 1624 WebGestureEvent event; | 1625 WebGestureEvent event; |
| 1625 event.type = WebInputEvent::GestureLongPress; | 1626 event.type = WebInputEvent::GestureLongPress; |
| 1626 event.sourceDevice = WebGestureDeviceTouchscreen; | 1627 event.sourceDevice = WebGestureDeviceTouchscreen; |
| 1627 event.x = 250; | 1628 event.x = 250; |
| 1628 event.y = 150; | 1629 event.y = 150; |
| 1629 | 1630 |
| 1630 EXPECT_EQ(WebInputEventResult::NotHandled, webView->handleInputEvent(event))
; | 1631 EXPECT_EQ(WebInputEventResult::NotHandled, webView->handleInputEvent(event))
; |
| 1631 } | 1632 } |
| 1632 | 1633 |
| 1634 TEST_F(WebViewTest, LongPressEmptyDivAlwaysShow) |
| 1635 { |
| 1636 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), |
| 1637 WebString::fromUTF8("long_press_empty_div.html")); |
| 1638 |
| 1639 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_p
ress_empty_div.html", true); |
| 1640 webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(true); |
| 1641 webView->resize(WebSize(500, 300)); |
| 1642 webView->updateAllLifecyclePhases(); |
| 1643 runPendingTasks(); |
| 1644 |
| 1645 WebGestureEvent event; |
| 1646 event.type = WebInputEvent::GestureLongPress; |
| 1647 event.sourceDevice = WebGestureDeviceTouchscreen; |
| 1648 event.x = 250; |
| 1649 event.y = 150; |
| 1650 |
| 1651 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even
t)); |
| 1652 } |
| 1653 |
| 1633 TEST_F(WebViewTest, LongPressImage) | 1654 TEST_F(WebViewTest, LongPressImage) |
| 1634 { | 1655 { |
| 1635 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), | 1656 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), |
| 1636 WebString::fromUTF8("long_press_image.html")); | 1657 WebString::fromUTF8("long_press_image.html")); |
| 1637 | 1658 |
| 1638 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_p
ress_image.html", true); | 1659 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_p
ress_image.html", true); |
| 1660 webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(false); |
| 1639 webView->resize(WebSize(500, 300)); | 1661 webView->resize(WebSize(500, 300)); |
| 1640 webView->updateAllLifecyclePhases(); | 1662 webView->updateAllLifecyclePhases(); |
| 1641 runPendingTasks(); | 1663 runPendingTasks(); |
| 1642 | 1664 |
| 1643 WebGestureEvent event; | 1665 WebGestureEvent event; |
| 1644 event.type = WebInputEvent::GestureLongPress; | 1666 event.type = WebInputEvent::GestureLongPress; |
| 1645 event.sourceDevice = WebGestureDeviceTouchscreen; | 1667 event.sourceDevice = WebGestureDeviceTouchscreen; |
| 1646 event.x = 10; | 1668 event.x = 10; |
| 1647 event.y = 10; | 1669 event.y = 10; |
| 1648 | 1670 |
| 1649 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even
t)); | 1671 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even
t)); |
| 1650 } | 1672 } |
| 1651 | 1673 |
| 1652 TEST_F(WebViewTest, LongPressVideo) | 1674 TEST_F(WebViewTest, LongPressVideo) |
| 1653 { | 1675 { |
| 1654 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), | 1676 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), |
| 1655 WebString::fromUTF8("long_press_video.html")); | 1677 WebString::fromUTF8("long_press_video.html")); |
| 1656 | 1678 |
| 1657 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_p
ress_video.html", true); | 1679 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_p
ress_video.html", true); |
| 1680 webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(false); |
| 1658 webView->resize(WebSize(500, 300)); | 1681 webView->resize(WebSize(500, 300)); |
| 1659 webView->updateAllLifecyclePhases(); | 1682 webView->updateAllLifecyclePhases(); |
| 1660 runPendingTasks(); | 1683 runPendingTasks(); |
| 1661 | 1684 |
| 1662 WebGestureEvent event; | 1685 WebGestureEvent event; |
| 1663 event.type = WebInputEvent::GestureLongPress; | 1686 event.type = WebInputEvent::GestureLongPress; |
| 1664 event.sourceDevice = WebGestureDeviceTouchscreen; | 1687 event.sourceDevice = WebGestureDeviceTouchscreen; |
| 1665 event.x = 10; | 1688 event.x = 10; |
| 1666 event.y = 10; | 1689 event.y = 10; |
| 1667 | 1690 |
| 1668 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even
t)); | 1691 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even
t)); |
| 1669 } | 1692 } |
| 1670 | 1693 |
| 1671 TEST_F(WebViewTest, LongPressLink) | 1694 TEST_F(WebViewTest, LongPressLink) |
| 1672 { | 1695 { |
| 1673 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), | 1696 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), |
| 1674 WebString::fromUTF8("long_press_link.html")); | 1697 WebString::fromUTF8("long_press_link.html")); |
| 1675 | 1698 |
| 1676 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_p
ress_link.html", true); | 1699 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_p
ress_link.html", true); |
| 1700 webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(false); |
| 1677 webView->resize(WebSize(500, 300)); | 1701 webView->resize(WebSize(500, 300)); |
| 1678 webView->updateAllLifecyclePhases(); | 1702 webView->updateAllLifecyclePhases(); |
| 1679 runPendingTasks(); | 1703 runPendingTasks(); |
| 1680 | 1704 |
| 1681 WebGestureEvent event; | 1705 WebGestureEvent event; |
| 1682 event.type = WebInputEvent::GestureLongPress; | 1706 event.type = WebInputEvent::GestureLongPress; |
| 1683 event.sourceDevice = WebGestureDeviceTouchscreen; | 1707 event.sourceDevice = WebGestureDeviceTouchscreen; |
| 1684 event.x = 500; | 1708 event.x = 500; |
| 1685 event.y = 300; | 1709 event.y = 300; |
| 1686 | 1710 |
| 1687 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even
t)); | 1711 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even
t)); |
| 1688 } | 1712 } |
| 1689 | 1713 |
| 1690 TEST_F(WebViewTest, LongPressEmptyEditableSelection) | 1714 TEST_F(WebViewTest, LongPressEmptyEditableSelection) |
| 1691 { | 1715 { |
| 1692 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), | 1716 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), |
| 1693 WebString::fromUTF8("long_press_empty_editable_selection.html")); | 1717 WebString::fromUTF8("long_press_empty_editable_selection.html")); |
| 1694 | 1718 |
| 1695 WebViewImpl* webView = m_webViewHelper.initializeAndLoad( | 1719 WebViewImpl* webView = m_webViewHelper.initializeAndLoad( |
| 1696 m_baseURL + "long_press_empty_editable_selection.html", true); | 1720 m_baseURL + "long_press_empty_editable_selection.html", true); |
| 1721 webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(false); |
| 1697 webView->resize(WebSize(500, 300)); | 1722 webView->resize(WebSize(500, 300)); |
| 1698 webView->updateAllLifecyclePhases(); | 1723 webView->updateAllLifecyclePhases(); |
| 1699 runPendingTasks(); | 1724 runPendingTasks(); |
| 1700 | 1725 |
| 1701 WebGestureEvent event; | 1726 WebGestureEvent event; |
| 1702 event.type = WebInputEvent::GestureLongPress; | 1727 event.type = WebInputEvent::GestureLongPress; |
| 1703 event.sourceDevice = WebGestureDeviceTouchscreen; | 1728 event.sourceDevice = WebGestureDeviceTouchscreen; |
| 1704 event.x = 10; | 1729 event.x = 10; |
| 1705 event.y = 10; | 1730 event.y = 10; |
| 1706 | 1731 |
| (...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3156 frame->setAutofillClient(&client); | 3181 frame->setAutofillClient(&client); |
| 3157 webView->setInitialFocus(false); | 3182 webView->setInitialFocus(false); |
| 3158 | 3183 |
| 3159 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); | 3184 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); |
| 3160 EXPECT_EQ(1, client.textChangesFromUserGesture()); | 3185 EXPECT_EQ(1, client.textChangesFromUserGesture()); |
| 3161 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 3186 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
| 3162 frame->setAutofillClient(0); | 3187 frame->setAutofillClient(0); |
| 3163 } | 3188 } |
| 3164 | 3189 |
| 3165 } // namespace blink | 3190 } // namespace blink |
| OLD | NEW |