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

Unified Diff: third_party/WebKit/Source/web/tests/WebViewTest.cpp

Issue 1616813002: Consider Zoom factor when getting bounding rect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add TODOs. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/web/mac/WebSubstringUtil.mm ('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/web/tests/WebViewTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
index ff330cdf7300e65f08184913904f6fa42c02805b..11f7efd6639266603aafe45ada7853cafc04754d 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -94,6 +94,10 @@
#include "web/WebViewImpl.h"
#include "web/tests/FrameTestHelpers.h"
+#if OS(MACOSX)
+#include "public/web/mac/WebSubstringUtil.h"
+#endif
+
using blink::FrameTestHelpers::loadFrame;
using blink::URLTestHelpers::toKURL;
using blink::URLTestHelpers::registerMockedURLLoad;
@@ -3183,4 +3187,33 @@ TEST_F(WebViewTest, StopLoadingIfJavaScriptURLReturnsNoStringResult)
EXPECT_FALSE(document->frame()->isLoading());
}
+#if OS(MACOSX)
+TEST_F(WebViewTest, WebSubstringUtil)
+{
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("content_editable_populated.html"));
+ WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "content_editable_populated.html");
+ webView->settings()->setDefaultFontSize(12);
+ webView->resize(WebSize(400, 400));
+ WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame());
+ FrameView* frameView = frame->frame()->view();
+
+ WebPoint baselinePoint;
+ NSAttributedString* result = WebSubstringUtil::attributedSubstringInRange(frame, 10, 3, &baselinePoint);
+ ASSERT_TRUE(!!result);
+
+ WebPoint point(baselinePoint.x, frameView->height() - baselinePoint.y);
+ result = WebSubstringUtil::attributedWordAtPoint(webView, point, baselinePoint);
+ ASSERT_TRUE(!!result);
+
+ webView->setZoomLevel(3);
+
+ result = WebSubstringUtil::attributedSubstringInRange(frame, 5, 5, &baselinePoint);
+ ASSERT_TRUE(!!result);
+
+ point = WebPoint(baselinePoint.x, frameView->height() - baselinePoint.y);
+ result = WebSubstringUtil::attributedWordAtPoint(webView, point, baselinePoint);
+ ASSERT_TRUE(!!result);
+}
+#endif
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/web/mac/WebSubstringUtil.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698