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

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 a test. 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..b3390cb0100dd04ae21d262631f4d0ca147321aa 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,25 @@ 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");
keishi 2016/01/27 13:08:39 Looks like the font size is 1px because the defaul
Shu Chen 2016/01/27 13:58:28 Thanks, keishi@. Now I want to test for page is zo
+ webView->resize(WebSize(400, 400));
+ WebLocalFrame* frame = toWebLocalFrameImpl(webView->mainFrame());
+ LocalFrame* localFrame = toWebLocalFrameImpl(frame)->frame();
+ localFrame->view()->layout();
+
+ WebPoint baselinePoint;
+ NSAttributedString* result = WebSubstringUtil::attributedSubstringInRange(frame, 10, 3, &baselinePoint);
+ ASSERT_TRUE(!!result);
+ printf("=====baseline: %d, %d\n", baselinePoint.x, baselinePoint.y);
+
+ WebPoint point(baselinePoint.x, localFrame->view()->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