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

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

Issue 2227563003: Refactoring button field and its type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix new instances Created 4 years, 4 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/FrameHost.h" 8 #include "core/frame/FrameHost.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 1034
1035 WebMouseEvent mouseDownEvent; 1035 WebMouseEvent mouseDownEvent;
1036 mouseDownEvent.type = WebInputEvent::MouseDown; 1036 mouseDownEvent.type = WebInputEvent::MouseDown;
1037 mouseDownEvent.x = 10; 1037 mouseDownEvent.x = 10;
1038 mouseDownEvent.y = 10; 1038 mouseDownEvent.y = 10;
1039 mouseDownEvent.windowX = 10; 1039 mouseDownEvent.windowX = 10;
1040 mouseDownEvent.windowY = 10; 1040 mouseDownEvent.windowY = 10;
1041 mouseDownEvent.globalX = 110; 1041 mouseDownEvent.globalX = 110;
1042 mouseDownEvent.globalY = 210; 1042 mouseDownEvent.globalY = 210;
1043 mouseDownEvent.clickCount = 1; 1043 mouseDownEvent.clickCount = 1;
1044 mouseDownEvent.button = WebMouseEvent::ButtonRight; 1044 mouseDownEvent.button = WebMouseEvent::Button::Right;
1045 1045
1046 // Corresponding release event (Windows shows context menu on release). 1046 // Corresponding release event (Windows shows context menu on release).
1047 WebMouseEvent mouseUpEvent(mouseDownEvent); 1047 WebMouseEvent mouseUpEvent(mouseDownEvent);
1048 mouseUpEvent.type = WebInputEvent::MouseUp; 1048 mouseUpEvent.type = WebInputEvent::MouseUp;
1049 1049
1050 WebFrameClient* oldClient = webViewImpl()->mainFrameImpl()->client(); 1050 WebFrameClient* oldClient = webViewImpl()->mainFrameImpl()->client();
1051 MockWebFrameClient mockWebFrameClient; 1051 MockWebFrameClient mockWebFrameClient;
1052 EXPECT_CALL(mockWebFrameClient, showContextMenu(ContextMenuAtLocation(mouseD ownEvent.x, mouseDownEvent.y))); 1052 EXPECT_CALL(mockWebFrameClient, showContextMenu(ContextMenuAtLocation(mouseD ownEvent.x, mouseDownEvent.y)));
1053 1053
1054 // Do a sanity check with no scale applied. 1054 // Do a sanity check with no scale applied.
1055 webViewImpl()->mainFrameImpl()->setClient(&mockWebFrameClient); 1055 webViewImpl()->mainFrameImpl()->setClient(&mockWebFrameClient);
1056 webViewImpl()->handleInputEvent(mouseDownEvent); 1056 webViewImpl()->handleInputEvent(mouseDownEvent);
1057 webViewImpl()->handleInputEvent(mouseUpEvent); 1057 webViewImpl()->handleInputEvent(mouseUpEvent);
1058 1058
1059 Mock::VerifyAndClearExpectations(&mockWebFrameClient); 1059 Mock::VerifyAndClearExpectations(&mockWebFrameClient);
1060 mouseDownEvent.button = WebMouseEvent::ButtonLeft; 1060 mouseDownEvent.button = WebMouseEvent::Button::Left;
1061 webViewImpl()->handleInputEvent(mouseDownEvent); 1061 webViewImpl()->handleInputEvent(mouseDownEvent);
1062 1062
1063 // Now pinch zoom into the page and move the visual viewport. The context 1063 // Now pinch zoom into the page and move the visual viewport. The context
1064 // menu should still appear at the location of the event, relative to the 1064 // menu should still appear at the location of the event, relative to the
1065 // WebView. 1065 // WebView.
1066 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport (); 1066 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport ();
1067 webViewImpl()->setPageScaleFactor(2); 1067 webViewImpl()->setPageScaleFactor(2);
1068 visualViewport.setLocation(FloatPoint(60, 80)); 1068 visualViewport.setLocation(FloatPoint(60, 80));
1069 EXPECT_CALL(mockWebFrameClient, showContextMenu(ContextMenuAtLocation(mouseD ownEvent.x, mouseDownEvent.y))); 1069 EXPECT_CALL(mockWebFrameClient, showContextMenu(ContextMenuAtLocation(mouseD ownEvent.x, mouseDownEvent.y)));
1070 1070
1071 mouseDownEvent.button = WebMouseEvent::ButtonRight; 1071 mouseDownEvent.button = WebMouseEvent::Button::Right;
1072 webViewImpl()->handleInputEvent(mouseDownEvent); 1072 webViewImpl()->handleInputEvent(mouseDownEvent);
1073 webViewImpl()->handleInputEvent(mouseUpEvent); 1073 webViewImpl()->handleInputEvent(mouseUpEvent);
1074 1074
1075 // Reset the old client so destruction can occur naturally. 1075 // Reset the old client so destruction can occur naturally.
1076 webViewImpl()->mainFrameImpl()->setClient(oldClient); 1076 webViewImpl()->mainFrameImpl()->setClient(oldClient);
1077 } 1077 }
1078 1078
1079 // Test that the client is notified if page scroll events. 1079 // Test that the client is notified if page scroll events.
1080 TEST_P(ParameterizedVisualViewportTest, TestClientNotifiedOfScrollEvents) 1080 TEST_P(ParameterizedVisualViewportTest, TestClientNotifiedOfScrollEvents)
1081 { 1081 {
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); 1855 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView();
1856 frameView.layoutViewportScrollableArea()->setScrollPosition(DoublePoint(700, 500), ProgrammaticScroll); 1856 frameView.layoutViewportScrollableArea()->setScrollPosition(DoublePoint(700, 500), ProgrammaticScroll);
1857 1857
1858 webViewImpl()->resize(IntSize(400, 300)); 1858 webViewImpl()->resize(IntSize(400, 300));
1859 EXPECT_POINT_EQ(DoublePoint(300, 200), frameView.layoutViewportScrollableAre a()->scrollPositionDouble()); 1859 EXPECT_POINT_EQ(DoublePoint(300, 200), frameView.layoutViewportScrollableAre a()->scrollPositionDouble());
1860 1860
1861 RuntimeEnabledFeatures::setScrollAnchoringEnabled(wasScrollAnchoringEnabled) ; 1861 RuntimeEnabledFeatures::setScrollAnchoringEnabled(wasScrollAnchoringEnabled) ;
1862 } 1862 }
1863 1863
1864 } // namespace 1864 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698