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 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 | 1636 |
1637 WebGestureEvent event; | 1637 WebGestureEvent event; |
1638 event.type = WebInputEvent::GestureLongPress; | 1638 event.type = WebInputEvent::GestureLongPress; |
1639 event.sourceDevice = WebGestureDeviceTouchscreen; | 1639 event.sourceDevice = WebGestureDeviceTouchscreen; |
1640 event.x = 10; | 1640 event.x = 10; |
1641 event.y = 10; | 1641 event.y = 10; |
1642 | 1642 |
1643 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even
t)); | 1643 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even
t)); |
1644 } | 1644 } |
1645 | 1645 |
| 1646 TEST_F(WebViewTest, LongPressEmptyNonEditableSelection) |
| 1647 { |
| 1648 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), |
| 1649 WebString::fromUTF8("long_press_image.html")); |
| 1650 |
| 1651 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_p
ress_image.html", true); |
| 1652 webView->resize(WebSize(500, 500)); |
| 1653 webView->updateAllLifecyclePhases(); |
| 1654 runPendingTasks(); |
| 1655 |
| 1656 WebGestureEvent event; |
| 1657 event.type = WebInputEvent::GestureLongPress; |
| 1658 event.sourceDevice = WebGestureDeviceTouchscreen; |
| 1659 event.x = 300; |
| 1660 event.y = 300; |
| 1661 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
| 1662 |
| 1663 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even
t)); |
| 1664 EXPECT_TRUE(frame->selectionAsText().isEmpty()); |
| 1665 } |
| 1666 |
1646 TEST_F(WebViewTest, LongPressSelection) | 1667 TEST_F(WebViewTest, LongPressSelection) |
1647 { | 1668 { |
1648 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("longpress_selection.html")); | 1669 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("longpress_selection.html")); |
1649 | 1670 |
1650 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_
selection.html", true); | 1671 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_
selection.html", true); |
1651 webView->resize(WebSize(500, 300)); | 1672 webView->resize(WebSize(500, 300)); |
1652 webView->updateAllLifecyclePhases(); | 1673 webView->updateAllLifecyclePhases(); |
1653 runPendingTasks(); | 1674 runPendingTasks(); |
1654 | 1675 |
1655 WebString target = WebString::fromUTF8("target"); | 1676 WebString target = WebString::fromUTF8("target"); |
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3111 frame->setAutofillClient(&client); | 3132 frame->setAutofillClient(&client); |
3112 webView->setInitialFocus(false); | 3133 webView->setInitialFocus(false); |
3113 | 3134 |
3114 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); | 3135 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); |
3115 EXPECT_EQ(1, client.textChangesFromUserGesture()); | 3136 EXPECT_EQ(1, client.textChangesFromUserGesture()); |
3116 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 3137 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
3117 frame->setAutofillClient(0); | 3138 frame->setAutofillClient(0); |
3118 } | 3139 } |
3119 | 3140 |
3120 } // namespace blink | 3141 } // namespace blink |
OLD | NEW |