| 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 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1698 | 1698 |
| 1699 WebGestureEvent event; | 1699 WebGestureEvent event; |
| 1700 event.type = WebInputEvent::GestureLongPress; | 1700 event.type = WebInputEvent::GestureLongPress; |
| 1701 event.sourceDevice = WebGestureDeviceTouchscreen; | 1701 event.sourceDevice = WebGestureDeviceTouchscreen; |
| 1702 event.x = 500; | 1702 event.x = 500; |
| 1703 event.y = 300; | 1703 event.y = 300; |
| 1704 | 1704 |
| 1705 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even
t)); | 1705 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even
t)); |
| 1706 } | 1706 } |
| 1707 | 1707 |
| 1708 TEST_F(WebViewTest, showContextMenuOnLongPressingLinks) |
| 1709 { |
| 1710 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), |
| 1711 WebString::fromUTF8("long_press_links_and_images.html")); |
| 1712 |
| 1713 URLTestHelpers::registerMockedURLLoad(toKURL("http://www.test.com/foo.png"),
"white-1x1.png"); |
| 1714 WebViewImpl* webView = m_webViewHelper.initializeAndLoad( |
| 1715 m_baseURL + "long_press_links_and_images.html", true); |
| 1716 |
| 1717 webView->settingsImpl()->setTouchDragDropEnabled(true); |
| 1718 webView->resize(WebSize(500, 300)); |
| 1719 webView->updateAllLifecyclePhases(); |
| 1720 runPendingTasks(); |
| 1721 |
| 1722 WebString anchorTagId = WebString::fromUTF8("anchorTag"); |
| 1723 WebString imageTagId = WebString::fromUTF8("imageTag"); |
| 1724 |
| 1725 EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, anchorTagId)); |
| 1726 EXPECT_STREQ("anchor contextmenu", webView->mainFrame()->document().title().
utf8().data()); |
| 1727 |
| 1728 EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, imageTagId)); |
| 1729 EXPECT_STREQ("image contextmenu", webView->mainFrame()->document().title().u
tf8().data()); |
| 1730 } |
| 1731 |
| 1708 TEST_F(WebViewTest, LongPressEmptyEditableSelection) | 1732 TEST_F(WebViewTest, LongPressEmptyEditableSelection) |
| 1709 { | 1733 { |
| 1710 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), | 1734 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), |
| 1711 WebString::fromUTF8("long_press_empty_editable_selection.html")); | 1735 WebString::fromUTF8("long_press_empty_editable_selection.html")); |
| 1712 | 1736 |
| 1713 WebViewImpl* webView = m_webViewHelper.initializeAndLoad( | 1737 WebViewImpl* webView = m_webViewHelper.initializeAndLoad( |
| 1714 m_baseURL + "long_press_empty_editable_selection.html", true); | 1738 m_baseURL + "long_press_empty_editable_selection.html", true); |
| 1715 webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(false); | 1739 webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(false); |
| 1716 webView->resize(WebSize(500, 300)); | 1740 webView->resize(WebSize(500, 300)); |
| 1717 webView->updateAllLifecyclePhases(); | 1741 webView->updateAllLifecyclePhases(); |
| (...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3280 EXPECT_TRUE(webView->page()->defersLoading()); | 3304 EXPECT_TRUE(webView->page()->defersLoading()); |
| 3281 } | 3305 } |
| 3282 | 3306 |
| 3283 EXPECT_TRUE(webView->page()->defersLoading()); | 3307 EXPECT_TRUE(webView->page()->defersLoading()); |
| 3284 } | 3308 } |
| 3285 | 3309 |
| 3286 EXPECT_FALSE(webView->page()->defersLoading()); | 3310 EXPECT_FALSE(webView->page()->defersLoading()); |
| 3287 } | 3311 } |
| 3288 | 3312 |
| 3289 } // namespace blink | 3313 } // namespace blink |
| OLD | NEW |