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

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

Issue 1471993002: Resume cursor blinking on closing context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: robusted onContextMenuClosed() and fixed nits Created 5 years 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/web/WebViewImpl.cpp ('k') | third_party/WebKit/public/web/WebView.h » ('j') | 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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 1631
1632 WebKeyboardEvent keyEvent; 1632 WebKeyboardEvent keyEvent;
1633 keyEvent.type = WebInputEvent::RawKeyDown; 1633 keyEvent.type = WebInputEvent::RawKeyDown;
1634 webView->handleInputEvent(keyEvent); 1634 webView->handleInputEvent(keyEvent);
1635 keyEvent.type = WebInputEvent::KeyUp; 1635 keyEvent.type = WebInputEvent::KeyUp;
1636 webView->handleInputEvent(keyEvent); 1636 webView->handleInputEvent(keyEvent);
1637 EXPECT_FALSE(mainFrame->frame()->selection().isCaretBlinkingSuspended()); 1637 EXPECT_FALSE(mainFrame->frame()->selection().isCaretBlinkingSuspended());
1638 } 1638 }
1639 #endif 1639 #endif
1640 1640
1641 TEST_F(WebViewTest, BlinkCaretOnClosingContextMenu)
1642 {
1643 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("form.html"));
1644 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form.html" , true);
1645
1646 webView->setInitialFocus(false);
1647 runPendingTasks();
1648
1649 // We suspend caret blinking when pressing with mouse right button.
1650 // Note that we do not send MouseUp event here since it will be consumed
1651 // by the context menu once it shows up.
1652 WebMouseEvent mouseEvent;
1653 mouseEvent.button = WebMouseEvent::ButtonRight;
1654 mouseEvent.x = 1;
1655 mouseEvent.y = 1;
1656 mouseEvent.clickCount = 1;
1657 mouseEvent.type = WebInputEvent::MouseDown;
1658 webView->handleInputEvent(mouseEvent);
1659 runPendingTasks();
1660
1661 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webView->mainFrame());
1662 EXPECT_TRUE(mainFrame->frame()->selection().isCaretBlinkingSuspended());
1663
1664 // Caret blinking is still suspended after showing context menu.
1665 webView->showContextMenu();
1666 EXPECT_TRUE(mainFrame->frame()->selection().isCaretBlinkingSuspended());
1667
1668 // Caret blinking will be resumed only after context menu is closed.
1669 webView->didCloseContextMenu();
1670
1671 EXPECT_FALSE(mainFrame->frame()->selection().isCaretBlinkingSuspended());
1672 }
1673
1641 TEST_F(WebViewTest, SelectionOnReadOnlyInput) 1674 TEST_F(WebViewTest, SelectionOnReadOnlyInput)
1642 { 1675 {
1643 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("selection_readonly.html")); 1676 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("selection_readonly.html"));
1644 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "selection_ readonly.html", true); 1677 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "selection_ readonly.html", true);
1645 webView->resize(WebSize(640, 480)); 1678 webView->resize(WebSize(640, 480));
1646 webView->updateAllLifecyclePhases(); 1679 webView->updateAllLifecyclePhases();
1647 runPendingTasks(); 1680 runPendingTasks();
1648 1681
1649 std::string testWord = "This text should be selected."; 1682 std::string testWord = "This text should be selected.";
1650 1683
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
3141 WebFrame* frame = mainWebView.webView()->mainFrame(); 3174 WebFrame* frame = mainWebView.webView()->mainFrame();
3142 v8::HandleScope scope(v8::Isolate::GetCurrent()); 3175 v8::HandleScope scope(v8::Isolate::GetCurrent());
3143 v8::Local<v8::Value> v8Value = frame->executeScriptAndReturnValue(WebScriptS ource("var win = window.open('javascript:false'); win.document")); 3176 v8::Local<v8::Value> v8Value = frame->executeScriptAndReturnValue(WebScriptS ource("var win = window.open('javascript:false'); win.document"));
3144 ASSERT_TRUE(v8Value->IsObject()); 3177 ASSERT_TRUE(v8Value->IsObject());
3145 Document* document = V8Document::toImplWithTypeCheck(v8::Isolate::GetCurrent (), v8Value); 3178 Document* document = V8Document::toImplWithTypeCheck(v8::Isolate::GetCurrent (), v8Value);
3146 ASSERT_TRUE(document); 3179 ASSERT_TRUE(document);
3147 EXPECT_FALSE(document->frame()->isLoading()); 3180 EXPECT_FALSE(document->frame()->isLoading());
3148 } 3181 }
3149 3182
3150 } // namespace blink 3183 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | third_party/WebKit/public/web/WebView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698