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

Side by Side Diff: content/public/test/browser_test_utils.cc

Issue 2046843003: Merge "Fix webview crash on attempt to scroll." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 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
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/public/test/browser_test_utils.h" 5 #include "content/public/test/browser_test_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 widget_host->ForwardGestureEvent(scroll_update); 502 widget_host->ForwardGestureEvent(scroll_update);
503 503
504 blink::WebGestureEvent scroll_end; 504 blink::WebGestureEvent scroll_end;
505 scroll_end.type = blink::WebGestureEvent::GestureScrollEnd; 505 scroll_end.type = blink::WebGestureEvent::GestureScrollEnd;
506 scroll_end.sourceDevice = blink::WebGestureDeviceTouchpad; 506 scroll_end.sourceDevice = blink::WebGestureDeviceTouchpad;
507 scroll_end.x = point.x() + delta.x(); 507 scroll_end.x = point.x() + delta.x();
508 scroll_end.y = point.y() + delta.y(); 508 scroll_end.y = point.y() + delta.y();
509 widget_host->ForwardGestureEvent(scroll_end); 509 widget_host->ForwardGestureEvent(scroll_end);
510 } 510 }
511 511
512 void SimulateGestureFlingSequence(WebContents* web_contents,
513 const gfx::Point& point,
514 const gfx::Vector2dF& velocity) {
515 RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From(
516 web_contents->GetRenderViewHost()->GetWidget());
517
518 blink::WebGestureEvent scroll_begin;
519 scroll_begin.type = blink::WebGestureEvent::GestureScrollBegin;
520 scroll_begin.sourceDevice = blink::WebGestureDeviceTouchpad;
521 scroll_begin.x = point.x();
522 scroll_begin.y = point.y();
523 widget_host->ForwardGestureEvent(scroll_begin);
524
525 blink::WebGestureEvent scroll_end;
526 scroll_end.type = blink::WebGestureEvent::GestureScrollEnd;
527 scroll_end.sourceDevice = blink::WebGestureDeviceTouchpad;
528 scroll_end.x = point.x();
529 scroll_end.y = point.y();
530 widget_host->ForwardGestureEvent(scroll_end);
531
532 blink::WebGestureEvent fling_start;
533 fling_start.type = blink::WebGestureEvent::GestureFlingStart;
534 fling_start.sourceDevice = blink::WebGestureDeviceTouchpad;
535 fling_start.x = point.x();
536 fling_start.y = point.y();
537 fling_start.data.flingStart.targetViewport = false;
538 fling_start.data.flingStart.velocityX = velocity.x();
539 fling_start.data.flingStart.velocityY = velocity.y();
540 widget_host->ForwardGestureEvent(fling_start);
541 }
542
512 void SimulateTapAt(WebContents* web_contents, const gfx::Point& point) { 543 void SimulateTapAt(WebContents* web_contents, const gfx::Point& point) {
513 blink::WebGestureEvent tap; 544 blink::WebGestureEvent tap;
514 tap.type = blink::WebGestureEvent::GestureTap; 545 tap.type = blink::WebGestureEvent::GestureTap;
515 tap.sourceDevice = blink::WebGestureDeviceTouchpad; 546 tap.sourceDevice = blink::WebGestureDeviceTouchpad;
516 tap.x = point.x(); 547 tap.x = point.x();
517 tap.y = point.y(); 548 tap.y = point.y();
518 tap.modifiers = blink::WebInputEvent::ControlKey; 549 tap.modifiers = blink::WebInputEvent::ControlKey;
519 RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From( 550 RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From(
520 web_contents->GetRenderViewHost()->GetWidget()); 551 web_contents->GetRenderViewHost()->GetWidget());
521 widget_host->ForwardGestureEvent(tap); 552 widget_host->ForwardGestureEvent(tap);
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1273 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1243 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) 1274 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN)
1244 return ack_result_; 1275 return ack_result_;
1245 base::RunLoop run_loop; 1276 base::RunLoop run_loop;
1246 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); 1277 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure());
1247 run_loop.Run(); 1278 run_loop.Run();
1248 return ack_result_; 1279 return ack_result_;
1249 } 1280 }
1250 1281
1251 } // namespace content 1282 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698