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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp

Issue 2603063002: Only clear tooltip message on a user scroll or compositor scroll. (Closed)
Patch Set: Fix PLSA logic to include frame scrolls Created 3 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp
index e8cf0304d3902a19f43177471dc23b6e68e523ce..6f474214e8a68d80d9e93887991dd4fd84954203 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableAreaTest.cpp
@@ -11,13 +11,36 @@
#include "platform/graphics/GraphicsLayer.h"
#include "platform/scroll/ScrollTypes.h"
#include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+using testing::_;
namespace blink {
+namespace {
+
+class MockChromeClient : public EmptyChromeClient {
+ public:
+ MOCK_METHOD3(mockSetToolTip, void(LocalFrame*, const String&, TextDirection));
+ void setToolTip(LocalFrame& frame,
+ const String& tooltipText,
+ TextDirection dir) override {
+ mockSetToolTip(&frame, tooltipText, dir);
+ }
+};
+
+} // namespace {
class PaintLayerScrollableAreaTest : public RenderingTest {
public:
PaintLayerScrollableAreaTest()
- : RenderingTest(EmptyFrameLoaderClient::create()) {}
+ : RenderingTest(EmptyFrameLoaderClient::create()),
+ m_chromeClient(new MockChromeClient) {}
+
+ ~PaintLayerScrollableAreaTest() {
+ testing::Mock::VerifyAndClearExpectations(&chromeClient());
+ }
+
+ MockChromeClient& chromeClient() const override { return *m_chromeClient; }
BackgroundPaintLocation backgroundPaintLocation(const char* elementId) {
PaintLayer* paintLayer =
@@ -30,6 +53,8 @@ class PaintLayerScrollableAreaTest : public RenderingTest {
RenderingTest::SetUp();
enableCompositing();
}
+
+ Persistent<MockChromeClient> m_chromeClient;
};
TEST_F(PaintLayerScrollableAreaTest,
@@ -498,4 +523,29 @@ TEST_F(PaintLayerScrollableAreaTest,
ASSERT_TRUE(paintLayer);
EXPECT_TRUE(paintLayer->needsCompositedScrolling());
}
+
+TEST_F(PaintLayerScrollableAreaTest, HideTooltipWhenScrollPositionChanges) {
+ setBodyInnerHTML(
+ "<style>"
+ "#scroller { width: 100px; height: 100px; overflow: scroll; }"
+ "#scrolled { height: 300px; }"
+ "</style>"
+ "<div id=\"scroller\"><div id=\"scrolled\"></div></div>");
+ document().view()->updateAllLifecyclePhases();
+
+ Element* scroller = document().getElementById("scroller");
+ PaintLayerScrollableArea* scrollableArea =
+ toLayoutBoxModelObject(scroller->layoutObject())->getScrollableArea();
+ ASSERT_TRUE(scrollableArea);
+
+ EXPECT_CALL(chromeClient(), mockSetToolTip(document().frame(), String(), _))
+ .Times(1);
+ scrollableArea->setScrollOffset(ScrollOffset(1, 1), UserScroll);
+
+ // Programmatic scrolling should not dismiss the tooltip, so setToolTip
+ // should not be called for this invocation.
+ EXPECT_CALL(chromeClient(), mockSetToolTip(document().frame(), String(), _))
+ .Times(0);
+ scrollableArea->setScrollOffset(ScrollOffset(2, 2), ProgrammaticScroll);
+}
}
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698