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

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

Issue 2592263003: Send an empty tooltip text when hovering over a different node (Closed)
Patch Set: Send an empty tooltip text when hoverring over a different node Created 3 years, 11 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/page/ChromeClient.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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 10733 matching lines...) Expand 10 before | Expand all | Expand 10 after
10744 scrollerArea->horizontalScrollbar()->shouldParticipateInHitTesting()); 10744 scrollerArea->horizontalScrollbar()->shouldParticipateInHitTesting());
10745 EXPECT_FALSE( 10745 EXPECT_FALSE(
10746 scrollerArea->verticalScrollbar()->shouldParticipateInHitTesting()); 10746 scrollerArea->verticalScrollbar()->shouldParticipateInHitTesting());
10747 scrollerArea->setScrollbarsHidden(false); 10747 scrollerArea->setScrollbarsHidden(false);
10748 EXPECT_TRUE( 10748 EXPECT_TRUE(
10749 scrollerArea->horizontalScrollbar()->shouldParticipateInHitTesting()); 10749 scrollerArea->horizontalScrollbar()->shouldParticipateInHitTesting());
10750 EXPECT_TRUE( 10750 EXPECT_TRUE(
10751 scrollerArea->verticalScrollbar()->shouldParticipateInHitTesting()); 10751 scrollerArea->verticalScrollbar()->shouldParticipateInHitTesting());
10752 } 10752 }
10753 10753
10754 TEST_F(WebFrameTest, MouseOverDifferntNodeClearsTooltip) {
10755 FrameTestHelpers::WebViewHelper webViewHelper;
10756 webViewHelper.initialize(true, nullptr, nullptr, nullptr,
10757 [](WebSettings* settings) {});
10758 webViewHelper.resize(WebSize(200, 200));
10759 WebViewImpl* webView = webViewHelper.webView();
10760
10761 initializeWithHTML(
10762 *webView->mainFrameImpl()->frame(),
10763 "<head>"
10764 " <style type='text/css'>"
10765 " div"
10766 " {"
10767 " width: 200px;"
10768 " height: 100px;"
10769 " background-color: #eeeeff;"
10770 " }"
10771 " div:hover"
10772 " {"
10773 " background-color: #ddddff;"
10774 " }"
10775 " </style>"
10776 "</head>"
10777 "<body>"
10778 " <div id='div1' title='Title Attribute Value'>Hover HERE</div>"
10779 " <div id='div2' title='Title Attribute Value'>Then HERE</div>"
10780 " <br><br><br>"
10781 "</body>");
10782
10783 webView->updateAllLifecyclePhases();
10784
10785 Document* document = webView->mainFrameImpl()->frame()->document();
10786 Element* div1Tag = document->getElementById("div1");
10787
10788 HitTestResult hitTestResult = webView->coreHitTestResultAt(
10789 WebPoint(div1Tag->offsetLeft() + 5, div1Tag->offsetTop() + 5));
10790
10791 EXPECT_TRUE(hitTestResult.innerElement());
10792
10793 // Mouse over link. Mouse cursor should be hand.
10794 PlatformMouseEvent mouseMoveOverLinkEvent(
10795 IntPoint(div1Tag->offsetLeft() + 5, div1Tag->offsetTop() + 5),
10796 IntPoint(div1Tag->offsetLeft() + 5, div1Tag->offsetTop() + 5),
10797 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0,
10798 PlatformEvent::NoModifiers, TimeTicks::Now());
10799 document->frame()->eventHandler().handleMouseMoveEvent(
10800 mouseMoveOverLinkEvent, Vector<PlatformMouseEvent>());
10801
10802 EXPECT_EQ(document->hoverNode(),
10803 document->frame()->chromeClient().lastSetTooltipNodeForTesting());
10804 EXPECT_EQ(div1Tag,
10805 document->frame()->chromeClient().lastSetTooltipNodeForTesting());
10806
10807 Element* div2Tag = document->getElementById("div2");
10808
10809 PlatformMouseEvent mouseMoveEvent(
10810 IntPoint(div2Tag->offsetLeft() + 5, div2Tag->offsetTop() + 5),
10811 IntPoint(div2Tag->offsetLeft() + 5, div2Tag->offsetTop() + 5),
10812 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0,
10813 PlatformEvent::NoModifiers, TimeTicks::Now());
10814 document->frame()->eventHandler().handleMouseMoveEvent(
10815 mouseMoveEvent, Vector<PlatformMouseEvent>());
10816
10817 EXPECT_EQ(document->hoverNode(),
10818 document->frame()->chromeClient().lastSetTooltipNodeForTesting());
10819 EXPECT_EQ(div2Tag,
10820 document->frame()->chromeClient().lastSetTooltipNodeForTesting());
10821 }
10822
10754 // Makes sure that mouse hover over an overlay scrollbar doesn't activate 10823 // Makes sure that mouse hover over an overlay scrollbar doesn't activate
10755 // elements below unless the scrollbar is faded out. 10824 // elements below unless the scrollbar is faded out.
10756 TEST_F(WebFrameTest, MouseOverLinkAndOverlayScrollbar) { 10825 TEST_F(WebFrameTest, MouseOverLinkAndOverlayScrollbar) {
10757 FrameTestHelpers::WebViewHelper webViewHelper; 10826 FrameTestHelpers::WebViewHelper webViewHelper;
10758 webViewHelper.initialize(true, nullptr, nullptr, nullptr, 10827 webViewHelper.initialize(true, nullptr, nullptr, nullptr,
10759 [](WebSettings* settings) {}); 10828 [](WebSettings* settings) {});
10760 webViewHelper.resize(WebSize(20, 20)); 10829 webViewHelper.resize(WebSize(20, 20));
10761 WebViewImpl* webView = webViewHelper.webView(); 10830 WebViewImpl* webView = webViewHelper.webView();
10762 10831
10763 initializeWithHTML(*webView->mainFrameImpl()->frame(), 10832 initializeWithHTML(*webView->mainFrameImpl()->frame(),
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
11161 11230
11162 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); 11231 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached());
11163 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); 11232 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading());
11164 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); 11233 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad());
11165 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); 11234 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents());
11166 11235
11167 webViewHelper.reset(); 11236 webViewHelper.reset();
11168 } 11237 }
11169 11238
11170 } // namespace blink 11239 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/ChromeClient.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698