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

Side by Side Diff: third_party/WebKit/Source/web/tests/VisualViewportTest.cpp

Issue 2621303004: Keep track of coalesced events in main thread event queue (Closed)
Patch Set: Rebase Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/VisualViewport.h" 5 #include "core/frame/VisualViewport.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/BrowserControls.h" 8 #include "core/frame/BrowserControls.h"
9 #include "core/frame/FrameHost.h" 9 #include "core/frame/FrameHost.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 WebMouseEvent mouseUpEvent(mouseDownEvent); 1160 WebMouseEvent mouseUpEvent(mouseDownEvent);
1161 mouseUpEvent.setType(WebInputEvent::MouseUp); 1161 mouseUpEvent.setType(WebInputEvent::MouseUp);
1162 1162
1163 WebFrameClient* oldClient = webViewImpl()->mainFrameImpl()->client(); 1163 WebFrameClient* oldClient = webViewImpl()->mainFrameImpl()->client();
1164 MockWebFrameClient mockWebFrameClient; 1164 MockWebFrameClient mockWebFrameClient;
1165 EXPECT_CALL(mockWebFrameClient, showContextMenu(ContextMenuAtLocation( 1165 EXPECT_CALL(mockWebFrameClient, showContextMenu(ContextMenuAtLocation(
1166 mouseDownEvent.x, mouseDownEvent.y))); 1166 mouseDownEvent.x, mouseDownEvent.y)));
1167 1167
1168 // Do a sanity check with no scale applied. 1168 // Do a sanity check with no scale applied.
1169 webViewImpl()->mainFrameImpl()->setClient(&mockWebFrameClient); 1169 webViewImpl()->mainFrameImpl()->setClient(&mockWebFrameClient);
1170 webViewImpl()->handleInputEvent(mouseDownEvent); 1170 webViewImpl()->handleInputEvent(WebCoalescedInputEvent(mouseDownEvent));
1171 webViewImpl()->handleInputEvent(mouseUpEvent); 1171 webViewImpl()->handleInputEvent(WebCoalescedInputEvent(mouseUpEvent));
1172 1172
1173 Mock::VerifyAndClearExpectations(&mockWebFrameClient); 1173 Mock::VerifyAndClearExpectations(&mockWebFrameClient);
1174 mouseDownEvent.button = WebMouseEvent::Button::Left; 1174 mouseDownEvent.button = WebMouseEvent::Button::Left;
1175 webViewImpl()->handleInputEvent(mouseDownEvent); 1175 webViewImpl()->handleInputEvent(WebCoalescedInputEvent(mouseDownEvent));
1176 1176
1177 // Now pinch zoom into the page and move the visual viewport. The context menu 1177 // Now pinch zoom into the page and move the visual viewport. The context menu
1178 // should still appear at the location of the event, relative to the WebView. 1178 // should still appear at the location of the event, relative to the WebView.
1179 VisualViewport& visualViewport = 1179 VisualViewport& visualViewport =
1180 frame()->page()->frameHost().visualViewport(); 1180 frame()->page()->frameHost().visualViewport();
1181 webViewImpl()->setPageScaleFactor(2); 1181 webViewImpl()->setPageScaleFactor(2);
1182 EXPECT_CALL(mockWebFrameClient, didChangeScrollOffset(_)); 1182 EXPECT_CALL(mockWebFrameClient, didChangeScrollOffset(_));
1183 visualViewport.setLocation(FloatPoint(60, 80)); 1183 visualViewport.setLocation(FloatPoint(60, 80));
1184 EXPECT_CALL(mockWebFrameClient, showContextMenu(ContextMenuAtLocation( 1184 EXPECT_CALL(mockWebFrameClient, showContextMenu(ContextMenuAtLocation(
1185 mouseDownEvent.x, mouseDownEvent.y))); 1185 mouseDownEvent.x, mouseDownEvent.y)));
1186 1186
1187 mouseDownEvent.button = WebMouseEvent::Button::Right; 1187 mouseDownEvent.button = WebMouseEvent::Button::Right;
1188 webViewImpl()->handleInputEvent(mouseDownEvent); 1188 webViewImpl()->handleInputEvent(WebCoalescedInputEvent(mouseDownEvent));
1189 webViewImpl()->handleInputEvent(mouseUpEvent); 1189 webViewImpl()->handleInputEvent(WebCoalescedInputEvent(mouseUpEvent));
1190 1190
1191 // Reset the old client so destruction can occur naturally. 1191 // Reset the old client so destruction can occur naturally.
1192 webViewImpl()->mainFrameImpl()->setClient(oldClient); 1192 webViewImpl()->mainFrameImpl()->setClient(oldClient);
1193 } 1193 }
1194 1194
1195 // Test that the client is notified if page scroll events. 1195 // Test that the client is notified if page scroll events.
1196 TEST_P(VisualViewportTest, TestClientNotifiedOfScrollEvents) { 1196 TEST_P(VisualViewportTest, TestClientNotifiedOfScrollEvents) {
1197 initializeWithAndroidSettings(); 1197 initializeWithAndroidSettings();
1198 webViewImpl()->resize(IntSize(200, 300)); 1198 webViewImpl()->resize(IntSize(200, 300));
1199 1199
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 2008
2009 WebGestureEvent pinchUpdate(WebInputEvent::GesturePinchUpdate, 2009 WebGestureEvent pinchUpdate(WebInputEvent::GesturePinchUpdate,
2010 WebInputEvent::NoModifiers, 2010 WebInputEvent::NoModifiers,
2011 WebInputEvent::TimeStampForTesting); 2011 WebInputEvent::TimeStampForTesting);
2012 pinchUpdate.sourceDevice = WebGestureDeviceTouchpad; 2012 pinchUpdate.sourceDevice = WebGestureDeviceTouchpad;
2013 pinchUpdate.x = 100; 2013 pinchUpdate.x = 100;
2014 pinchUpdate.y = 100; 2014 pinchUpdate.y = 100;
2015 pinchUpdate.data.pinchUpdate.scale = 2; 2015 pinchUpdate.data.pinchUpdate.scale = 2;
2016 pinchUpdate.data.pinchUpdate.zoomDisabled = false; 2016 pinchUpdate.data.pinchUpdate.zoomDisabled = false;
2017 2017
2018 webViewImpl()->handleInputEvent(pinchUpdate); 2018 webViewImpl()->handleInputEvent(WebCoalescedInputEvent(pinchUpdate));
2019 2019
2020 VisualViewport& visualViewport = 2020 VisualViewport& visualViewport =
2021 webViewImpl()->page()->frameHost().visualViewport(); 2021 webViewImpl()->page()->frameHost().visualViewport();
2022 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); 2022 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView();
2023 2023
2024 EXPECT_FLOAT_SIZE_EQ(FloatSize(50, 50), visualViewport.getScrollOffset()); 2024 EXPECT_FLOAT_SIZE_EQ(FloatSize(50, 50), visualViewport.getScrollOffset());
2025 EXPECT_SIZE_EQ(ScrollOffset(0, 0), 2025 EXPECT_SIZE_EQ(ScrollOffset(0, 0),
2026 frameView.layoutViewportScrollableArea()->getScrollOffset()); 2026 frameView.layoutViewportScrollableArea()->getScrollOffset());
2027 } 2027 }
2028 2028
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
2471 " body {" 2471 " body {"
2472 " margin: 0px;" 2472 " margin: 0px;"
2473 " }" 2473 " }"
2474 " div { height:110vh; width: 110vw; }" 2474 " div { height:110vh; width: 110vw; }"
2475 "</style>" 2475 "</style>"
2476 "<div></div>", 2476 "<div></div>",
2477 baseURL); 2477 baseURL);
2478 } 2478 }
2479 2479
2480 } // namespace 2480 } // namespace
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/TouchActionTest.cpp ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698