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

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: Update the test Created 3 years, 6 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 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override { 112 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override {
113 if (always_overscroll_ && 113 if (always_overscroll_ &&
114 event.GetType() == blink::WebInputEvent::kGestureScrollUpdate) { 114 event.GetType() == blink::WebInputEvent::kGestureScrollUpdate) {
115 DidOverscroll(blink::WebFloatSize(event.data.scroll_update.delta_x, 115 DidOverscroll(blink::WebFloatSize(event.data.scroll_update.delta_x,
116 event.data.scroll_update.delta_y), 116 event.data.scroll_update.delta_y),
117 blink::WebFloatSize(event.data.scroll_update.delta_x, 117 blink::WebFloatSize(event.data.scroll_update.delta_x,
118 event.data.scroll_update.delta_y), 118 event.data.scroll_update.delta_y),
119 blink::WebFloatPoint(event.x, event.y), 119 blink::WebFloatPoint(event.x, event.y),
120 blink::WebFloatSize(event.data.scroll_update.velocity_x, 120 blink::WebFloatSize(event.data.scroll_update.velocity_x,
121 event.data.scroll_update.velocity_y)); 121 event.data.scroll_update.velocity_y),
122 blink::WebScrollBoundaryBehavior());
122 return true; 123 return true;
123 } 124 }
124 125
125 return false; 126 return false;
126 } 127 }
127 128
128 bool Send(IPC::Message* msg) override { 129 bool Send(IPC::Message* msg) override {
129 sink_.OnMessageReceived(*msg); 130 sink_.OnMessageReceived(*msg);
130 delete msg; 131 delete msg;
131 return true; 132 return true;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 EXPECT_EQ(gfx::Vector2dF(), ack.overscroll->current_fling_velocity); 280 EXPECT_EQ(gfx::Vector2dF(), ack.overscroll->current_fling_velocity);
280 EXPECT_EQ(gfx::PointF(-10, 0), ack.overscroll->causal_event_viewport_point); 281 EXPECT_EQ(gfx::PointF(-10, 0), ack.overscroll->causal_event_viewport_point);
281 widget()->sink()->ClearMessages(); 282 widget()->sink()->ClearMessages();
282 } 283 }
283 284
284 TEST_F(RenderWidgetUnittest, FlingOverscroll) { 285 TEST_F(RenderWidgetUnittest, FlingOverscroll) {
285 // Overscroll notifications received outside of handling an input event should 286 // Overscroll notifications received outside of handling an input event should
286 // be sent as a separate IPC. 287 // be sent as a separate IPC.
287 widget()->DidOverscroll(blink::WebFloatSize(10, 5), blink::WebFloatSize(5, 5), 288 widget()->DidOverscroll(blink::WebFloatSize(10, 5), blink::WebFloatSize(5, 5),
288 blink::WebFloatPoint(1, 1), 289 blink::WebFloatPoint(1, 1),
289 blink::WebFloatSize(10, 5)); 290 blink::WebFloatSize(10, 5),
291 blink::WebScrollBoundaryBehavior());
290 ASSERT_EQ(1u, widget()->sink()->message_count()); 292 ASSERT_EQ(1u, widget()->sink()->message_count());
291 const IPC::Message* message = widget()->sink()->GetMessageAt(0); 293 const IPC::Message* message = widget()->sink()->GetMessageAt(0);
292 ASSERT_EQ(InputHostMsg_DidOverscroll::ID, message->type()); 294 ASSERT_EQ(InputHostMsg_DidOverscroll::ID, message->type());
293 InputHostMsg_DidOverscroll::Param params; 295 InputHostMsg_DidOverscroll::Param params;
294 InputHostMsg_DidOverscroll::Read(message, &params); 296 InputHostMsg_DidOverscroll::Read(message, &params);
295 const ui::DidOverscrollParams& overscroll = std::get<0>(params); 297 const ui::DidOverscrollParams& overscroll = std::get<0>(params);
296 EXPECT_EQ(gfx::Vector2dF(10, 5), overscroll.latest_overscroll_delta); 298 EXPECT_EQ(gfx::Vector2dF(10, 5), overscroll.latest_overscroll_delta);
297 EXPECT_EQ(gfx::Vector2dF(5, 5), overscroll.accumulated_overscroll); 299 EXPECT_EQ(gfx::Vector2dF(5, 5), overscroll.accumulated_overscroll);
298 EXPECT_EQ(gfx::PointF(1, 1), overscroll.causal_event_viewport_point); 300 EXPECT_EQ(gfx::PointF(1, 1), overscroll.causal_event_viewport_point);
299 EXPECT_EQ(gfx::Vector2dF(10, 5), overscroll.current_fling_velocity); 301 EXPECT_EQ(gfx::Vector2dF(10, 5), overscroll.current_fling_velocity);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 blink::WebRect popup_emulated_rect(130, 170, 100, 400); 535 blink::WebRect popup_emulated_rect(130, 170, 100, 400);
534 widget()->SetWindowRect(popup_emulated_rect); 536 widget()->SetWindowRect(popup_emulated_rect);
535 537
536 EXPECT_EQ(popup_emulated_rect.x, widget()->WindowRect().x); 538 EXPECT_EQ(popup_emulated_rect.x, widget()->WindowRect().x);
537 EXPECT_EQ(popup_emulated_rect.y, widget()->WindowRect().y); 539 EXPECT_EQ(popup_emulated_rect.y, widget()->WindowRect().y);
538 EXPECT_EQ(popup_emulated_rect.x, widget()->ViewRect().x); 540 EXPECT_EQ(popup_emulated_rect.x, widget()->ViewRect().x);
539 EXPECT_EQ(popup_emulated_rect.y, widget()->ViewRect().y); 541 EXPECT_EQ(popup_emulated_rect.y, widget()->ViewRect().y);
540 } 542 }
541 543
542 } // namespace content 544 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698