Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: third_party/WebKit/Source/web/tests/WebViewTest.cpp

Issue 2078143002: Make plugin elements return false from canStartSelection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix readonly-disabled-text-selection for changes in r401155 Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 1644
1645 WebGestureEvent event; 1645 WebGestureEvent event;
1646 event.type = WebInputEvent::GestureLongPress; 1646 event.type = WebInputEvent::GestureLongPress;
1647 event.sourceDevice = WebGestureDeviceTouchscreen; 1647 event.sourceDevice = WebGestureDeviceTouchscreen;
1648 event.x = 250; 1648 event.x = 250;
1649 event.y = 150; 1649 event.y = 150;
1650 1650
1651 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even t)); 1651 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even t));
1652 } 1652 }
1653 1653
1654 TEST_F(WebViewTest, LongPressObject)
1655 {
1656 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()),
1657 WebString::fromUTF8("long_press_object.html"));
1658
1659 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_p ress_object.html", true);
1660 webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(true);
1661 webView->resize(WebSize(500, 300));
1662 webView->updateAllLifecyclePhases();
1663 runPendingTasks();
1664
1665 WebGestureEvent event;
1666 event.type = WebInputEvent::GestureLongPress;
1667 event.sourceDevice = WebGestureDeviceTouchscreen;
1668 event.x = 10;
1669 event.y = 10;
1670
1671 EXPECT_NE(WebInputEventResult::HandledSystem, webView->handleInputEvent(even t));
1672
1673 HTMLElement* element = toHTMLElement(webView->mainFrame()->document().getEle mentById("obj"));
1674 EXPECT_FALSE(element->canStartSelection());
1675 }
1676
1677 TEST_F(WebViewTest, LongPressObjectFallback)
1678 {
1679 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()),
1680 WebString::fromUTF8("long_press_object_fallback.html"));
1681
1682 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_p ress_object_fallback.html", true);
1683 webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(true);
1684 webView->resize(WebSize(500, 300));
1685 webView->updateAllLifecyclePhases();
1686 runPendingTasks();
1687
1688 WebGestureEvent event;
1689 event.type = WebInputEvent::GestureLongPress;
1690 event.sourceDevice = WebGestureDeviceTouchscreen;
1691 event.x = 10;
1692 event.y = 10;
1693
1694 EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(even t));
1695
1696 HTMLElement* element = toHTMLElement(webView->mainFrame()->document().getEle mentById("obj"));
1697 EXPECT_TRUE(element->canStartSelection());
1698 }
1699
1654 TEST_F(WebViewTest, LongPressImage) 1700 TEST_F(WebViewTest, LongPressImage)
1655 { 1701 {
1656 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), 1702 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()),
1657 WebString::fromUTF8("long_press_image.html")); 1703 WebString::fromUTF8("long_press_image.html"));
1658 1704
1659 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_p ress_image.html", true); 1705 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_p ress_image.html", true);
1660 webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(false); 1706 webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(false);
1661 webView->resize(WebSize(500, 300)); 1707 webView->resize(WebSize(500, 300));
1662 webView->updateAllLifecyclePhases(); 1708 webView->updateAllLifecyclePhases();
1663 runPendingTasks(); 1709 runPendingTasks();
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after
3181 frame->setAutofillClient(&client); 3227 frame->setAutofillClient(&client);
3182 webView->setInitialFocus(false); 3228 webView->setInitialFocus(false);
3183 3229
3184 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel lo").c_str()))); 3230 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel lo").c_str())));
3185 EXPECT_EQ(1, client.textChangesFromUserGesture()); 3231 EXPECT_EQ(1, client.textChangesFromUserGesture());
3186 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); 3232 EXPECT_FALSE(UserGestureIndicator::processingUserGesture());
3187 frame->setAutofillClient(0); 3233 frame->setAutofillClient(0);
3188 } 3234 }
3189 3235
3190 } // namespace blink 3236 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698