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

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

Issue 2104883002: Change text selection iterator behaviour for non-editable empty selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added myself in AUTHORS list. Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/SelectionController.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/SelectionController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698