OLD | NEW |
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 Loading... |
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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 tap.type = blink::WebGestureEvent::GestureTap; | 518 tap.type = blink::WebGestureEvent::GestureTap; |
517 tap.sourceDevice = blink::WebGestureDeviceTouchpad; | 519 tap.sourceDevice = blink::WebGestureDeviceTouchpad; |
518 tap.x = point.x(); | 520 tap.x = point.x(); |
519 tap.y = point.y(); | 521 tap.y = point.y(); |
520 tap.modifiers = modifiers; | 522 tap.modifiers = modifiers; |
521 RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From( | 523 RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From( |
522 web_contents->GetRenderViewHost()->GetWidget()); | 524 web_contents->GetRenderViewHost()->GetWidget()); |
523 widget_host->ForwardGestureEvent(tap); | 525 widget_host->ForwardGestureEvent(tap); |
524 } | 526 } |
525 | 527 |
| 528 #if defined(USE_AURA) |
526 void SimulateTouchPressAt(WebContents* web_contents, const gfx::Point& point) { | 529 void SimulateTouchPressAt(WebContents* web_contents, const gfx::Point& point) { |
527 SyntheticWebTouchEvent touch; | 530 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, point, 0, base::TimeDelta()); |
528 touch.PressPoint(point.x(), point.y()); | 531 static_cast<RenderWidgetHostViewAura*>( |
529 RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From( | 532 web_contents->GetRenderWidgetHostView()) |
530 web_contents->GetRenderViewHost()->GetWidget()); | 533 ->OnTouchEvent(&touch); |
531 widget_host->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo()); | |
532 } | 534 } |
| 535 #endif |
533 | 536 |
534 void SimulateKeyPress(WebContents* web_contents, | 537 void SimulateKeyPress(WebContents* web_contents, |
535 ui::KeyboardCode key_code, | 538 ui::KeyboardCode key_code, |
536 bool control, | 539 bool control, |
537 bool shift, | 540 bool shift, |
538 bool alt, | 541 bool alt, |
539 bool command) { | 542 bool command) { |
540 SimulateKeyPressWithCode( | 543 SimulateKeyPressWithCode( |
541 web_contents, key_code, std::string(), control, shift, alt, command); | 544 web_contents, key_code, std::string(), control, shift, alt, command); |
542 } | 545 } |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 void FrameWatcher::WaitFrames(int frames_to_wait) { | 1095 void FrameWatcher::WaitFrames(int frames_to_wait) { |
1093 if (frames_to_wait <= 0) | 1096 if (frames_to_wait <= 0) |
1094 return; | 1097 return; |
1095 base::RunLoop run_loop; | 1098 base::RunLoop run_loop; |
1096 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); | 1099 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); |
1097 base::AutoReset<int> reset_frames_to_wait(&frames_to_wait_, frames_to_wait); | 1100 base::AutoReset<int> reset_frames_to_wait(&frames_to_wait_, frames_to_wait); |
1098 run_loop.Run(); | 1101 run_loop.Run(); |
1099 } | 1102 } |
1100 | 1103 |
1101 } // namespace content | 1104 } // namespace content |
OLD | NEW |