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

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

Issue 1412923009: Route touch-events for WebViewGuest directly to guest renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments (saving first this time). Created 5 years 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 (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 "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "testing/gtest/include/gtest/gtest.h" 42 #include "testing/gtest/include/gtest/gtest.h"
43 #include "ui/base/resource/resource_bundle.h" 43 #include "ui/base/resource/resource_bundle.h"
44 #include "ui/compositor/test/draw_waiter_for_test.h" 44 #include "ui/compositor/test/draw_waiter_for_test.h"
45 #include "ui/events/gesture_detection/gesture_configuration.h" 45 #include "ui/events/gesture_detection/gesture_configuration.h"
46 #include "ui/events/keycodes/dom/dom_code.h" 46 #include "ui/events/keycodes/dom/dom_code.h"
47 #include "ui/events/keycodes/dom/keycode_converter.h" 47 #include "ui/events/keycodes/dom/keycode_converter.h"
48 #include "ui/events/latency_info.h" 48 #include "ui/events/latency_info.h"
49 #include "ui/resources/grit/webui_resources.h" 49 #include "ui/resources/grit/webui_resources.h"
50 50
51 #if defined(USE_AURA) 51 #if defined(USE_AURA)
52 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
52 #include "ui/aura/test/window_event_dispatcher_test_api.h" 53 #include "ui/aura/test/window_event_dispatcher_test_api.h"
53 #include "ui/aura/window.h" 54 #include "ui/aura/window.h"
54 #include "ui/aura/window_event_dispatcher.h" 55 #include "ui/aura/window_event_dispatcher.h"
55 #include "ui/aura/window_tree_host.h" 56 #include "ui/aura/window_tree_host.h"
57 #include "ui/events/event.h"
56 #endif // USE_AURA 58 #endif // USE_AURA
57 59
58 namespace content { 60 namespace content {
59 namespace { 61 namespace {
60 62
61 class DOMOperationObserver : public NotificationObserver, 63 class DOMOperationObserver : public NotificationObserver,
62 public WebContentsObserver { 64 public WebContentsObserver {
63 public: 65 public:
64 explicit DOMOperationObserver(RenderViewHost* rvh) 66 explicit DOMOperationObserver(RenderViewHost* rvh)
65 : WebContentsObserver(WebContents::FromRenderViewHost(rvh)), 67 : WebContentsObserver(WebContents::FromRenderViewHost(rvh)),
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 tap.type = blink::WebGestureEvent::GestureTap; 521 tap.type = blink::WebGestureEvent::GestureTap;
520 tap.sourceDevice = blink::WebGestureDeviceTouchpad; 522 tap.sourceDevice = blink::WebGestureDeviceTouchpad;
521 tap.x = point.x(); 523 tap.x = point.x();
522 tap.y = point.y(); 524 tap.y = point.y();
523 tap.modifiers = modifiers; 525 tap.modifiers = modifiers;
524 RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From( 526 RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From(
525 web_contents->GetRenderViewHost()->GetWidget()); 527 web_contents->GetRenderViewHost()->GetWidget());
526 widget_host->ForwardGestureEvent(tap); 528 widget_host->ForwardGestureEvent(tap);
527 } 529 }
528 530
531 #if defined(USE_AURA)
529 void SimulateTouchPressAt(WebContents* web_contents, const gfx::Point& point) { 532 void SimulateTouchPressAt(WebContents* web_contents, const gfx::Point& point) {
530 SyntheticWebTouchEvent touch; 533 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, point, 0, base::TimeDelta());
531 touch.PressPoint(point.x(), point.y()); 534 static_cast<RenderWidgetHostViewAura*>(
532 RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From( 535 web_contents->GetRenderWidgetHostView())
533 web_contents->GetRenderViewHost()->GetWidget()); 536 ->OnTouchEvent(&touch);
534 widget_host->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo());
535 } 537 }
538 #endif
536 539
537 void SimulateKeyPress(WebContents* web_contents, 540 void SimulateKeyPress(WebContents* web_contents,
538 ui::KeyboardCode key_code, 541 ui::KeyboardCode key_code,
539 bool control, 542 bool control,
540 bool shift, 543 bool shift,
541 bool alt, 544 bool alt,
542 bool command) { 545 bool command) {
543 SimulateKeyPressWithCode( 546 SimulateKeyPressWithCode(
544 web_contents, key_code, std::string(), control, shift, alt, command); 547 web_contents, key_code, std::string(), control, shift, alt, command);
545 } 548 }
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 void FrameWatcher::WaitFrames(int frames_to_wait) { 1098 void FrameWatcher::WaitFrames(int frames_to_wait) {
1096 if (frames_to_wait <= 0) 1099 if (frames_to_wait <= 0)
1097 return; 1100 return;
1098 base::RunLoop run_loop; 1101 base::RunLoop run_loop;
1099 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); 1102 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure());
1100 base::AutoReset<int> reset_frames_to_wait(&frames_to_wait_, frames_to_wait); 1103 base::AutoReset<int> reset_frames_to_wait(&frames_to_wait_, frames_to_wait);
1101 run_loop.Run(); 1104 run_loop.Run();
1102 } 1105 }
1103 1106
1104 } // namespace content 1107 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | content/renderer/browser_plugin/browser_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698