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 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 TEST_F(WebViewTest, LongPressSelection) | 1601 TEST_F(WebViewTest, LongPressSelection) |
1602 { | 1602 { |
1603 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("longpress_selection.html")); | 1603 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("longpress_selection.html")); |
1604 | 1604 |
1605 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_
selection.html", true); | 1605 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_
selection.html", true); |
1606 webView->resize(WebSize(500, 300)); | 1606 webView->resize(WebSize(500, 300)); |
1607 webView->updateAllLifecyclePhases(); | 1607 webView->updateAllLifecyclePhases(); |
1608 runPendingTasks(); | 1608 runPendingTasks(); |
1609 | 1609 |
1610 WebString target = WebString::fromUTF8("target"); | 1610 WebString target = WebString::fromUTF8("target"); |
| 1611 WebString blanklinestextbox = WebString::fromUTF8("blanklinestextbox"); |
1611 WebString onselectstartfalse = WebString::fromUTF8("onselectstartfalse"); | 1612 WebString onselectstartfalse = WebString::fromUTF8("onselectstartfalse"); |
1612 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); | 1613 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); |
1613 | 1614 |
1614 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, onselec
tstartfalse)); | 1615 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, onselec
tstartfalse)); |
1615 EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data())); | 1616 EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data())); |
| 1617 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, blankli
nestextbox)); |
| 1618 EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data())); |
1616 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, target)
); | 1619 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, target)
); |
1617 EXPECT_EQ("testword", std::string(frame->selectionAsText().utf8().data())); | 1620 EXPECT_EQ("testword", std::string(frame->selectionAsText().utf8().data())); |
1618 } | 1621 } |
1619 | 1622 |
1620 TEST_F(WebViewTest, BlinkCaretOnTypingAfterLongPress) | 1623 TEST_F(WebViewTest, BlinkCaretOnTypingAfterLongPress) |
1621 { | 1624 { |
1622 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("blink_caret_on_typing_after_long_press.html")); | 1625 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("blink_caret_on_typing_after_long_press.html")); |
1623 | 1626 |
1624 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "blink_care
t_on_typing_after_long_press.html", true); | 1627 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "blink_care
t_on_typing_after_long_press.html", true); |
1625 webView->resize(WebSize(640, 480)); | 1628 webView->resize(WebSize(640, 480)); |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3210 result = WebSubstringUtil::attributedSubstringInRange(frame, 5, 5, &baseline
Point); | 3213 result = WebSubstringUtil::attributedSubstringInRange(frame, 5, 5, &baseline
Point); |
3211 ASSERT_TRUE(!!result); | 3214 ASSERT_TRUE(!!result); |
3212 | 3215 |
3213 point = WebPoint(baselinePoint.x, frameView->height() - baselinePoint.y); | 3216 point = WebPoint(baselinePoint.x, frameView->height() - baselinePoint.y); |
3214 result = WebSubstringUtil::attributedWordAtPoint(webView, point, baselinePoi
nt); | 3217 result = WebSubstringUtil::attributedWordAtPoint(webView, point, baselinePoi
nt); |
3215 ASSERT_TRUE(!!result); | 3218 ASSERT_TRUE(!!result); |
3216 } | 3219 } |
3217 #endif | 3220 #endif |
3218 | 3221 |
3219 } // namespace blink | 3222 } // namespace blink |
OLD | NEW |