Chromium Code Reviews| Index: third_party/WebKit/Source/web/tests/VisualViewportTest.cpp |
| diff --git a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp |
| index dbeb0157c38699d12b68f334a10bfda2fc4b1c2d..12ffc1c7f61706f0244e4e6a0af3f9a1abd26eb0 100644 |
| --- a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp |
| +++ b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp |
| @@ -195,6 +195,18 @@ public: |
| INSTANTIATE_TEST_CASE_P(All, ParameterizedVisualViewportTest, ::testing::Bool()); |
| +static WebGestureEvent fatTap(int x, int y) |
| +{ |
| + WebGestureEvent event; |
| + event.type = WebInputEvent::GestureTap; |
| + event.sourceDevice = WebGestureDeviceTouchscreen; |
| + event.x = x; |
| + event.y = y; |
| + event.data.tap.width = 50; |
| + event.data.tap.height = 50; |
| + return event; |
| +} |
| + |
| // Test that resizing the VisualViewport works as expected and that resizing the |
| // WebView resizes the VisualViewport. |
| TEST_P(ParameterizedVisualViewportTest, TestResize) |
| @@ -1924,4 +1936,28 @@ TEST_P(ParameterizedVisualViewportTest, RotationAnchoringWithRootScroller) |
| RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled); |
| } |
| +// Ensure that scrobar position correct when navigate to same page after resize |
|
bokan
2016/09/12 18:55:23
Nit: "Ensure that scrobar position correct when na
|
| +// crbug.com/642279 |
| +TEST_P(ParameterizedVisualViewportTest, ScrobarPositionForLinkToSamePageAfterResize) |
|
bokan
2016/09/12 18:55:23
Why do we need the resize? That's not part of the
chaopeng
2016/09/12 20:08:35
Is it resize == scale(zoom-in/zoom-out)? This bug
|
| +{ |
| + initializeWithAndroidSettings(); |
| + webViewImpl()->resize(IntSize(800, 600)); |
| + |
| + registerMockedHttpURLLoad("same-page-navigate.html"); |
| + navigateTo(m_baseURL + "same-page-navigate.html"); |
| + |
| + webViewImpl()->resize(IntSize(600, 800)); |
| + |
| + Element* link = frame()->document()->getElementById("same-page"); |
| + webViewImpl()->handleInputEvent(fatTap(link->offsetLeft(), link->offsetTop())); |
| + FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewImpl()->mainFrameImpl()); |
| + |
| + FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); |
| + EXPECT_POINT_EQ( |
| + DoublePoint(), |
| + frameView.layoutViewportScrollableArea()->scrollPositionDouble()); |
| +} |
| + |
| + |
| + |
| } // namespace |