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 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "public/web/WebView.h" | 32 #include "public/web/WebView.h" |
33 | 33 |
34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
35 #include "core/dom/Element.h" | 35 #include "core/dom/Element.h" |
| 36 #include "core/editing/FrameSelection.h" |
36 #include "core/frame/EventHandlerRegistry.h" | 37 #include "core/frame/EventHandlerRegistry.h" |
37 #include "core/frame/FrameView.h" | 38 #include "core/frame/FrameView.h" |
38 #include "core/frame/LocalFrame.h" | 39 #include "core/frame/LocalFrame.h" |
39 #include "core/frame/Settings.h" | 40 #include "core/frame/Settings.h" |
40 #include "core/html/HTMLDocument.h" | 41 #include "core/html/HTMLDocument.h" |
41 #include "core/html/HTMLIFrameElement.h" | 42 #include "core/html/HTMLIFrameElement.h" |
42 #include "core/html/HTMLInputElement.h" | 43 #include "core/html/HTMLInputElement.h" |
43 #include "core/html/HTMLTextAreaElement.h" | 44 #include "core/html/HTMLTextAreaElement.h" |
44 #include "core/loader/FrameLoadRequest.h" | 45 #include "core/loader/FrameLoadRequest.h" |
45 #include "core/page/Chrome.h" | 46 #include "core/page/Chrome.h" |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 | 1163 |
1163 WebString target = WebString::fromUTF8("target"); | 1164 WebString target = WebString::fromUTF8("target"); |
1164 WebString onselectstartfalse = WebString::fromUTF8("onselectstartfalse"); | 1165 WebString onselectstartfalse = WebString::fromUTF8("onselectstartfalse"); |
1165 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); | 1166 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
1166 | 1167 |
1167 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, onselec
tstartfalse)); | 1168 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, onselec
tstartfalse)); |
1168 EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data())); | 1169 EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data())); |
1169 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, target)
); | 1170 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, target)
); |
1170 EXPECT_EQ("testword", std::string(frame->selectionAsText().utf8().data())); | 1171 EXPECT_EQ("testword", std::string(frame->selectionAsText().utf8().data())); |
1171 } | 1172 } |
| 1173 |
| 1174 TEST_F(WebViewTest, BlinkCaretOnTypingAfterLongPress) |
| 1175 { |
| 1176 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("blink_caret_on_typing_after_long_press.html")); |
| 1177 |
| 1178 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "blink_care
t_on_typing_after_long_press.html", true); |
| 1179 webView->resize(WebSize(640, 480)); |
| 1180 webView->layout(); |
| 1181 runPendingTasks(); |
| 1182 |
| 1183 WebString target = WebString::fromUTF8("target"); |
| 1184 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webView->mainFrame()); |
| 1185 |
| 1186 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, target)
); |
| 1187 EXPECT_TRUE(mainFrame->frame()->selection().isCaretBlinkingSuspended()); |
| 1188 |
| 1189 WebKeyboardEvent keyEvent; |
| 1190 keyEvent.type = WebInputEvent::RawKeyDown; |
| 1191 webView->handleInputEvent(keyEvent); |
| 1192 keyEvent.type = WebInputEvent::KeyUp; |
| 1193 webView->handleInputEvent(keyEvent); |
| 1194 EXPECT_FALSE(mainFrame->frame()->selection().isCaretBlinkingSuspended()); |
| 1195 } |
1172 #endif | 1196 #endif |
1173 | 1197 |
1174 TEST_F(WebViewTest, SelectionOnDisabledInput) | 1198 TEST_F(WebViewTest, SelectionOnDisabledInput) |
1175 { | 1199 { |
1176 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("selection_disabled.html")); | 1200 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("selection_disabled.html")); |
1177 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "selection_
disabled.html", true); | 1201 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "selection_
disabled.html", true); |
1178 webView->resize(WebSize(640, 480)); | 1202 webView->resize(WebSize(640, 480)); |
1179 webView->layout(); | 1203 webView->layout(); |
1180 runPendingTasks(); | 1204 runPendingTasks(); |
1181 | 1205 |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2107 | 2131 |
2108 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); | 2132 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); |
2109 | 2133 |
2110 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr
omUTF8("target"))); | 2134 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr
omUTF8("target"))); |
2111 | 2135 |
2112 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); | 2136 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); |
2113 webView->setAutofillClient(0); | 2137 webView->setAutofillClient(0); |
2114 } | 2138 } |
2115 | 2139 |
2116 } // namespace | 2140 } // namespace |
OLD | NEW |