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

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

Issue 602583003: Revert of Use the pinch viewport offset for tap disambiguation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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/WebViewImpl.cpp ('k') | Source/web/tests/data/disambiguation_popup_200_by_800.html » ('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 b6413d10d32c0a9bab95477338ef1f4187243634..0794f7e863ab829b42401fb75e16123d1bd4272b 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -49,10 +49,8 @@
#include "core/editing/VisiblePosition.h"
#include "core/events/MouseEvent.h"
#include "core/fetch/MemoryCache.h"
-#include "core/frame/FrameHost.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
-#include "core/frame/PinchViewport.h"
#include "core/frame/Settings.h"
#include "core/html/HTMLDocument.h"
#include "core/html/HTMLFormElement.h"
@@ -118,25 +116,11 @@
const int touchPointPadding = 32;
-#define EXPECT_RECT_EQ(a, b) \
- do { \
- EXPECT_EQ(a.x(), b.x()); \
- EXPECT_EQ(a.y(), b.y()); \
- EXPECT_EQ(a.width(), b.width()); \
- EXPECT_EQ(a.height(), b.height()); \
- } while (false)
-
-#define EXPECT_POINT_EQ(expected, actual) \
- do { \
- EXPECT_EQ((expected).x(), (actual).x()); \
- EXPECT_EQ((expected).y(), (actual).y()); \
- } while (false)
-
-#define EXPECT_FLOAT_POINT_EQ(expected, actual) \
- do { \
- EXPECT_FLOAT_EQ((expected).x(), (actual).x()); \
- EXPECT_FLOAT_EQ((expected).y(), (actual).y()); \
- } while (false)
+#define EXPECT_EQ_RECT(a, b) \
+ EXPECT_EQ(a.x(), b.x()); \
+ EXPECT_EQ(a.y(), b.y()); \
+ EXPECT_EQ(a.width(), b.width()); \
+ EXPECT_EQ(a.height(), b.height());
class FakeCompositingWebViewClient : public FrameTestHelpers::TestWebViewClient {
public:
@@ -2213,7 +2197,7 @@
GraphicsContext context(&canvas);
context.setRegionTrackingMode(GraphicsContext::RegionTrackingOpaque);
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), context.opaqueRegion().asRect());
+ EXPECT_EQ_RECT(IntRect(0, 0, 0, 0), context.opaqueRegion().asRect());
FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->frameView();
IntRect paintRect(0, 0, 200, 200);
@@ -2227,7 +2211,7 @@
int viewportWidthMinusScrollbar = 50 - (view->verticalScrollbar()->isOverlayScrollbar() ? 0 : 15);
int viewportHeightMinusScrollbar = 50 - (view->horizontalScrollbar()->isOverlayScrollbar() ? 0 : 15);
IntRect clippedRect(0, 0, viewportWidthMinusScrollbar * 2, viewportHeightMinusScrollbar * 2);
- EXPECT_RECT_EQ(clippedRect, context.opaqueRegion().asRect());
+ EXPECT_EQ_RECT(clippedRect, context.opaqueRegion().asRect());
#endif
}
@@ -4147,7 +4131,7 @@
class DisambiguationPopupTestWebViewClient : public FrameTestHelpers::TestWebViewClient {
public:
- virtual bool didTapMultipleTargets(const WebSize&, const WebRect&, const WebVector<WebRect>& targetRects) OVERRIDE
+ virtual bool didTapMultipleTargets(const WebGestureEvent&, const WebVector<WebRect>& targetRects) OVERRIDE
{
EXPECT_GE(targetRects.size(), 2u);
m_triggered = true;
@@ -4303,57 +4287,6 @@
webViewHelper.webView()->handleInputEvent(fatTap(10 + i * 5, 590));
EXPECT_FALSE(client.triggered());
}
-}
-
-static void enableVirtualViewport(WebSettings* settings)
-{
- settings->setPinchVirtualViewportEnabled(true);
- settings->setViewportEnabled(true);
- settings->setViewportMetaEnabled(true);
- settings->setShrinksViewportContentToFit(true);
-}
-
-TEST_F(WebFrameTest, DisambiguationPopupPinchViewport)
-{
- const std::string htmlFile = "disambiguation_popup_200_by_800.html";
- registerMockedHttpURLLoad(htmlFile);
-
- DisambiguationPopupTestWebViewClient client;
-
- FrameTestHelpers::WebViewHelper webViewHelper;
- webViewHelper.initializeAndLoad(m_baseURL + htmlFile, true, 0, &client, enableVirtualViewport);
-
- WebViewImpl* webViewImpl = webViewHelper.webViewImpl();
- ASSERT_TRUE(webViewImpl);
- LocalFrame* frame = webViewImpl->mainFrameImpl()->frame();
- ASSERT_TRUE(frame);
-
- webViewHelper.webView()->resize(WebSize(200, 400));
-
- // Scroll main frame to the bottom of the document
- webViewImpl->setMainFrameScrollOffset(WebPoint(0, 400));
- EXPECT_POINT_EQ(IntPoint(0, 400), frame->view()->scrollPosition());
-
- webViewImpl->setPageScaleFactor(2.0);
-
- // Scroll pinch viewport to the top of the main frame.
- PinchViewport& pinchViewport = frame->page()->frameHost().pinchViewport();
- pinchViewport.setLocation(FloatPoint(0, 0));
- EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), pinchViewport.location());
-
- // Tap at the top: there is nothing there.
- client.resetTriggered();
- webViewHelper.webView()->handleInputEvent(fatTap(10, 60));
- EXPECT_FALSE(client.triggered());
-
- // Scroll pinch viewport to the bottom of the main frame.
- pinchViewport.setLocation(FloatPoint(0, 200));
- EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 200), pinchViewport.location());
-
- // Now the tap with the same coordinates should hit two elements.
- client.resetTriggered();
- webViewHelper.webView()->handleInputEvent(fatTap(10, 60));
- EXPECT_TRUE(client.triggered());
}
TEST_F(WebFrameTest, DisambiguationPopupBlacklist)
@@ -5788,9 +5721,9 @@
FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameView();
frameView->setFrameRect(IntRect(0, 0, 200, 200));
- EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), frameView->frameRect());
+ EXPECT_EQ_RECT(IntRect(0, 0, 200, 200), frameView->frameRect());
frameView->setFrameRect(IntRect(100, 100, 200, 200));
- EXPECT_RECT_EQ(IntRect(100, 100, 200, 200), frameView->frameRect());
+ EXPECT_EQ_RECT(IntRect(100, 100, 200, 200), frameView->frameRect());
}
TEST_F(WebFrameTest, FullscreenLayerNonScrollable)
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/disambiguation_popup_200_by_800.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698