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

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

Issue 2053213002: Don't suspend caret blinking on long press (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed unit test 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
« no previous file with comments | « third_party/WebKit/Source/core/input/KeyboardEventManager.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 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 1780
1781 WebString image = WebString::fromUTF8("purpleimage"); 1781 WebString image = WebString::fromUTF8("purpleimage");
1782 1782
1783 EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, image)); 1783 EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, image));
1784 size_t location, length; 1784 size_t location, length;
1785 EXPECT_TRUE(toWebViewImpl(webView)->caretOrSelectionRange(&location, &length )); 1785 EXPECT_TRUE(toWebViewImpl(webView)->caretOrSelectionRange(&location, &length ));
1786 EXPECT_EQ(0UL, location); 1786 EXPECT_EQ(0UL, location);
1787 EXPECT_EQ(1UL, length); 1787 EXPECT_EQ(1UL, length);
1788 } 1788 }
1789 1789
1790 TEST_F(WebViewTest, BlinkCaretOnTypingAfterLongPress) 1790 TEST_F(WebViewTest, BlinkCaretAfterLongPress)
1791 { 1791 {
1792 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("blink_caret_on_typing_after_long_press.html")); 1792 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("blink_caret_on_typing_after_long_press.html"));
1793 1793
1794 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "blink_care t_on_typing_after_long_press.html", true); 1794 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "blink_care t_on_typing_after_long_press.html", true);
1795 webView->resize(WebSize(640, 480)); 1795 webView->resize(WebSize(640, 480));
1796 webView->updateAllLifecyclePhases(); 1796 webView->updateAllLifecyclePhases();
1797 runPendingTasks(); 1797 runPendingTasks();
1798 1798
1799 WebString target = WebString::fromUTF8("target"); 1799 WebString target = WebString::fromUTF8("target");
1800 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webView->mainFrame()); 1800 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webView->mainFrame());
1801 1801
1802 EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, target)); 1802 EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, target));
1803 EXPECT_TRUE(mainFrame->frame()->selection().isCaretBlinkingSuspended());
1804
1805 WebKeyboardEvent keyEvent;
1806 keyEvent.type = WebInputEvent::RawKeyDown;
1807 webView->handleInputEvent(keyEvent);
1808 keyEvent.type = WebInputEvent::KeyUp;
1809 webView->handleInputEvent(keyEvent);
1810 EXPECT_FALSE(mainFrame->frame()->selection().isCaretBlinkingSuspended()); 1803 EXPECT_FALSE(mainFrame->frame()->selection().isCaretBlinkingSuspended());
1811 } 1804 }
1812 1805
1813 TEST_F(WebViewTest, BlinkCaretOnClosingContextMenu) 1806 TEST_F(WebViewTest, BlinkCaretOnClosingContextMenu)
1814 { 1807 {
1815 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("form.html")); 1808 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("form.html"));
1816 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form.html" , true); 1809 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form.html" , true);
1817 1810
1818 webView->setInitialFocus(false); 1811 webView->setInitialFocus(false);
1819 runPendingTasks(); 1812 runPendingTasks();
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
3181 frame->setAutofillClient(&client); 3174 frame->setAutofillClient(&client);
3182 webView->setInitialFocus(false); 3175 webView->setInitialFocus(false);
3183 3176
3184 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel lo").c_str()))); 3177 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel lo").c_str())));
3185 EXPECT_EQ(1, client.textChangesFromUserGesture()); 3178 EXPECT_EQ(1, client.textChangesFromUserGesture());
3186 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); 3179 EXPECT_FALSE(UserGestureIndicator::processingUserGesture());
3187 frame->setAutofillClient(0); 3180 frame->setAutofillClient(0);
3188 } 3181 }
3189 3182
3190 } // namespace blink 3183 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/KeyboardEventManager.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698