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

Side by Side Diff: content/renderer/render_widget_unittest.cc

Issue 2884423003: Use scroll-boundary-behavior to control overscroll-refresh/glow on android. (Closed)
Patch Set: Rebase Created 3 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 unified diff | Download patch
« no previous file with comments | « content/renderer/render_widget.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include <tuple> 7 #include <tuple>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override { 114 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override {
115 if (always_overscroll_ && 115 if (always_overscroll_ &&
116 event.GetType() == blink::WebInputEvent::kGestureScrollUpdate) { 116 event.GetType() == blink::WebInputEvent::kGestureScrollUpdate) {
117 DidOverscroll(blink::WebFloatSize(event.data.scroll_update.delta_x, 117 DidOverscroll(blink::WebFloatSize(event.data.scroll_update.delta_x,
118 event.data.scroll_update.delta_y), 118 event.data.scroll_update.delta_y),
119 blink::WebFloatSize(event.data.scroll_update.delta_x, 119 blink::WebFloatSize(event.data.scroll_update.delta_x,
120 event.data.scroll_update.delta_y), 120 event.data.scroll_update.delta_y),
121 blink::WebFloatPoint(event.x, event.y), 121 blink::WebFloatPoint(event.x, event.y),
122 blink::WebFloatSize(event.data.scroll_update.velocity_x, 122 blink::WebFloatSize(event.data.scroll_update.velocity_x,
123 event.data.scroll_update.velocity_y)); 123 event.data.scroll_update.velocity_y),
124 blink::WebScrollBoundaryBehavior());
124 return true; 125 return true;
125 } 126 }
126 127
127 return false; 128 return false;
128 } 129 }
129 130
130 bool Send(IPC::Message* msg) override { 131 bool Send(IPC::Message* msg) override {
131 sink_.OnMessageReceived(*msg); 132 sink_.OnMessageReceived(*msg);
132 delete msg; 133 delete msg;
133 return true; 134 return true;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 EXPECT_EQ(gfx::Vector2dF(), ack.overscroll->current_fling_velocity); 286 EXPECT_EQ(gfx::Vector2dF(), ack.overscroll->current_fling_velocity);
286 EXPECT_EQ(gfx::PointF(-10, 0), ack.overscroll->causal_event_viewport_point); 287 EXPECT_EQ(gfx::PointF(-10, 0), ack.overscroll->causal_event_viewport_point);
287 widget()->sink()->ClearMessages(); 288 widget()->sink()->ClearMessages();
288 } 289 }
289 290
290 TEST_F(RenderWidgetUnittest, FlingOverscroll) { 291 TEST_F(RenderWidgetUnittest, FlingOverscroll) {
291 // Overscroll notifications received outside of handling an input event should 292 // Overscroll notifications received outside of handling an input event should
292 // be sent as a separate IPC. 293 // be sent as a separate IPC.
293 widget()->DidOverscroll(blink::WebFloatSize(10, 5), blink::WebFloatSize(5, 5), 294 widget()->DidOverscroll(blink::WebFloatSize(10, 5), blink::WebFloatSize(5, 5),
294 blink::WebFloatPoint(1, 1), 295 blink::WebFloatPoint(1, 1),
295 blink::WebFloatSize(10, 5)); 296 blink::WebFloatSize(10, 5),
297 blink::WebScrollBoundaryBehavior());
296 ASSERT_EQ(1u, widget()->sink()->message_count()); 298 ASSERT_EQ(1u, widget()->sink()->message_count());
297 const IPC::Message* message = widget()->sink()->GetMessageAt(0); 299 const IPC::Message* message = widget()->sink()->GetMessageAt(0);
298 ASSERT_EQ(InputHostMsg_DidOverscroll::ID, message->type()); 300 ASSERT_EQ(InputHostMsg_DidOverscroll::ID, message->type());
299 InputHostMsg_DidOverscroll::Param params; 301 InputHostMsg_DidOverscroll::Param params;
300 InputHostMsg_DidOverscroll::Read(message, &params); 302 InputHostMsg_DidOverscroll::Read(message, &params);
301 const ui::DidOverscrollParams& overscroll = std::get<0>(params); 303 const ui::DidOverscrollParams& overscroll = std::get<0>(params);
302 EXPECT_EQ(gfx::Vector2dF(10, 5), overscroll.latest_overscroll_delta); 304 EXPECT_EQ(gfx::Vector2dF(10, 5), overscroll.latest_overscroll_delta);
303 EXPECT_EQ(gfx::Vector2dF(5, 5), overscroll.accumulated_overscroll); 305 EXPECT_EQ(gfx::Vector2dF(5, 5), overscroll.accumulated_overscroll);
304 EXPECT_EQ(gfx::PointF(1, 1), overscroll.causal_event_viewport_point); 306 EXPECT_EQ(gfx::PointF(1, 1), overscroll.causal_event_viewport_point);
305 EXPECT_EQ(gfx::Vector2dF(10, 5), overscroll.current_fling_velocity); 307 EXPECT_EQ(gfx::Vector2dF(10, 5), overscroll.current_fling_velocity);
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 blink::WebRect popup_emulated_rect(130, 170, 100, 400); 532 blink::WebRect popup_emulated_rect(130, 170, 100, 400);
531 widget()->SetWindowRect(popup_emulated_rect); 533 widget()->SetWindowRect(popup_emulated_rect);
532 534
533 EXPECT_EQ(popup_emulated_rect.x, widget()->WindowRect().x); 535 EXPECT_EQ(popup_emulated_rect.x, widget()->WindowRect().x);
534 EXPECT_EQ(popup_emulated_rect.y, widget()->WindowRect().y); 536 EXPECT_EQ(popup_emulated_rect.y, widget()->WindowRect().y);
535 EXPECT_EQ(popup_emulated_rect.x, widget()->ViewRect().x); 537 EXPECT_EQ(popup_emulated_rect.x, widget()->ViewRect().x);
536 EXPECT_EQ(popup_emulated_rect.y, widget()->ViewRect().y); 538 EXPECT_EQ(popup_emulated_rect.y, widget()->ViewRect().y);
537 } 539 }
538 540
539 } // namespace content 541 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698