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

Unified Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 899283004: Remove pinch zoom handling from the browser process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl_unittest.cc
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc
index e0102d2c7f7f1977f62f17415643f2361daf5ff7..b8ba32e8ec16d622b014fd372c34740983cc7277 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -2633,56 +2633,6 @@ TEST_F(WebContentsImplTest, HandleWheelEvent) {
contents()->SetDelegate(NULL);
}
-// Tests that trackpad GesturePinchUpdate events get turned into browser zoom.
-TEST_F(WebContentsImplTest, HandleGestureEvent) {
- using blink::WebGestureEvent;
- using blink::WebInputEvent;
-
- scoped_ptr<ContentsZoomChangedDelegate> delegate(
- new ContentsZoomChangedDelegate());
- contents()->SetDelegate(delegate.get());
-
- const float kZoomStepValue = 0.6f;
- blink::WebGestureEvent event = SyntheticWebGestureEventBuilder::Build(
- WebInputEvent::GesturePinchUpdate, blink::WebGestureDeviceTouchpad);
-
- // A pinch less than the step value doesn't change the zoom level.
- event.data.pinchUpdate.scale = 1.0f + kZoomStepValue * 0.8f;
- EXPECT_TRUE(contents()->HandleGestureEvent(event));
- EXPECT_EQ(0, delegate->GetAndResetContentsZoomChangedCallCount());
-
- // But repeating the event so the combined scale is greater does.
- EXPECT_TRUE(contents()->HandleGestureEvent(event));
- EXPECT_EQ(1, delegate->GetAndResetContentsZoomChangedCallCount());
- EXPECT_TRUE(delegate->last_zoom_in());
-
- // Pinching back out one step goes back to 100%.
- event.data.pinchUpdate.scale = 1.0f - kZoomStepValue;
- EXPECT_TRUE(contents()->HandleGestureEvent(event));
- EXPECT_EQ(1, delegate->GetAndResetContentsZoomChangedCallCount());
- EXPECT_FALSE(delegate->last_zoom_in());
-
- // Pinching out again doesn't zoom (step is twice as large around 100%).
- EXPECT_TRUE(contents()->HandleGestureEvent(event));
- EXPECT_EQ(0, delegate->GetAndResetContentsZoomChangedCallCount());
-
- // And again now it zooms once per step.
- EXPECT_TRUE(contents()->HandleGestureEvent(event));
- EXPECT_EQ(1, delegate->GetAndResetContentsZoomChangedCallCount());
- EXPECT_FALSE(delegate->last_zoom_in());
-
- // No other type of gesture event is handled by WebContentsImpl (for example
- // a touchscreen pinch gesture).
- event = SyntheticWebGestureEventBuilder::Build(
- WebInputEvent::GesturePinchUpdate, blink::WebGestureDeviceTouchscreen);
- event.data.pinchUpdate.scale = 1.0f + kZoomStepValue * 3;
- EXPECT_FALSE(contents()->HandleGestureEvent(event));
- EXPECT_EQ(0, delegate->GetAndResetContentsZoomChangedCallCount());
-
- // Ensure pointers to the delegate aren't kept beyond it's lifetime.
- contents()->SetDelegate(NULL);
-}
-
// Tests that GetRelatedActiveContentsCount is shared between related
// SiteInstances and includes WebContents that have not navigated yet.
TEST_F(WebContentsImplTest, ActiveContentsCountBasic) {
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698