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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 198683002: Make it possible to override the tickmarks for a WebFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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 | « Source/web/WebFrameImpl.cpp ('k') | public/web/WebFrame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index d39bc920fd639a006c07ef4aee8d6e911ac4ea86..6e4af2c568bc3b6548ef5385973d692ea90e561f 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -3383,6 +3383,60 @@ TEST_F(WebFrameTest, FindDetachFrameWhileScopingStrings)
holdSecondFrame.release();
}
+TEST_F(WebFrameTest, SetTickmarks)
+{
+ registerMockedHttpURLLoad("find.html");
+
+ FindUpdateWebFrameClient client;
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client);
+ webViewHelper.webView()->resize(WebSize(640, 480));
+ webViewHelper.webView()->layout();
+ runPendingTasks();
+
+ static const char* kFindString = "foo";
+ static const int kFindIdentifier = 12345;
+
+ WebFindOptions options;
+ WebString searchText = WebString::fromUTF8(kFindString);
+ WebFrameImpl* mainFrame = toWebFrameImpl(webViewHelper.webView()->mainFrame());
+ EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0));
+
+ mainFrame->resetMatchCount();
+ mainFrame->scopeStringMatches(kFindIdentifier, searchText, options, true);
+
+ runPendingTasks();
+ EXPECT_TRUE(client.findResultsAreReady());
+
+ // Get the tickmarks for the original find request.
+ WebCore::FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameView();
+ RefPtr<WebCore::Scrollbar> scrollbar = frameView->createScrollbar(WebCore::HorizontalScrollbar);
+ Vector<WebCore::IntRect> originalTickmarks;
+ scrollbar->getTickmarks(originalTickmarks);
+ EXPECT_EQ(4u, originalTickmarks.size());
+
+ // Override the tickmarks.
+ Vector<WebCore::IntRect> overridingTickmarksExpected;
+ overridingTickmarksExpected.append(WebCore::IntRect(0, 0, 100, 100));
+ overridingTickmarksExpected.append(WebCore::IntRect(0, 20, 100, 100));
+ overridingTickmarksExpected.append(WebCore::IntRect(0, 30, 100, 100));
+ mainFrame->setTickmarks(overridingTickmarksExpected);
+
+ // Check the tickmarks are overriden correctly.
+ Vector<WebCore::IntRect> overridingTickmarksActual;
+ scrollbar->getTickmarks(overridingTickmarksActual);
+ EXPECT_EQ(overridingTickmarksExpected, overridingTickmarksActual);
+
+ // Reset the tickmark behavior.
+ Vector<WebCore::IntRect> resetTickmarks;
+ mainFrame->setTickmarks(resetTickmarks);
+
+ // Check that the original tickmarks are returned
+ Vector<WebCore::IntRect> originalTickmarksAfterReset;
+ scrollbar->getTickmarks(originalTickmarksAfterReset);
+ EXPECT_EQ(originalTickmarks, originalTickmarksAfterReset);
+}
+
static WebPoint topLeft(const WebRect& rect)
{
return WebPoint(rect.x, rect.y);
« no previous file with comments | « Source/web/WebFrameImpl.cpp ('k') | public/web/WebFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698