Chromium Code Reviews| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 | 216 |
| 217 void CrashTab(WebContents* web_contents) { | 217 void CrashTab(WebContents* web_contents) { |
| 218 RenderProcessHost* rph = web_contents->GetRenderProcessHost(); | 218 RenderProcessHost* rph = web_contents->GetRenderProcessHost(); |
| 219 WindowedNotificationObserver observer( | 219 WindowedNotificationObserver observer( |
| 220 NOTIFICATION_RENDERER_PROCESS_CLOSED, | 220 NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| 221 Source<RenderProcessHost>(rph)); | 221 Source<RenderProcessHost>(rph)); |
| 222 base::KillProcess(rph->GetHandle(), 0, false); | 222 base::KillProcess(rph->GetHandle(), 0, false); |
| 223 observer.Wait(); | 223 observer.Wait(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void SimulateMouseClick(WebContents* web_contents) { | 226 void SimulateMouseClick(WebContents* web_contents, int modifiers, |
|
sky
2012/10/23 23:09:28
nit: wrap each param to a new line.
ericu
2012/10/23 23:15:44
Done.
| |
| 227 WebKit::WebMouseEvent::Button button) { | |
| 227 int x = web_contents->GetView()->GetContainerSize().width() / 2; | 228 int x = web_contents->GetView()->GetContainerSize().width() / 2; |
| 228 int y = web_contents->GetView()->GetContainerSize().height() / 2; | 229 int y = web_contents->GetView()->GetContainerSize().height() / 2; |
| 229 WebKit::WebMouseEvent mouse_event; | 230 WebKit::WebMouseEvent mouse_event; |
| 230 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 231 mouse_event.type = WebKit::WebInputEvent::MouseDown; |
| 231 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; | 232 mouse_event.button = button; |
| 232 mouse_event.x = x; | 233 mouse_event.x = x; |
| 233 mouse_event.y = y; | 234 mouse_event.y = y; |
| 235 mouse_event.modifiers = modifiers; | |
| 234 // Mac needs globalX/globalY for events to plugins. | 236 // Mac needs globalX/globalY for events to plugins. |
| 235 gfx::Rect offset; | 237 gfx::Rect offset; |
| 236 web_contents->GetView()->GetContainerBounds(&offset); | 238 web_contents->GetView()->GetContainerBounds(&offset); |
| 237 mouse_event.globalX = x + offset.x(); | 239 mouse_event.globalX = x + offset.x(); |
| 238 mouse_event.globalY = y + offset.y(); | 240 mouse_event.globalY = y + offset.y(); |
| 239 mouse_event.clickCount = 1; | 241 mouse_event.clickCount = 1; |
| 240 web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 242 web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
| 241 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 243 mouse_event.type = WebKit::WebInputEvent::MouseUp; |
| 242 web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 244 web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
| 243 } | 245 } |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 } | 604 } |
| 603 // The queue should not be empty, unless we were quit because of a timeout. | 605 // The queue should not be empty, unless we were quit because of a timeout. |
| 604 if (message_queue_.empty()) | 606 if (message_queue_.empty()) |
| 605 return false; | 607 return false; |
| 606 if (message) | 608 if (message) |
| 607 *message = message_queue_.front(); | 609 *message = message_queue_.front(); |
| 608 return true; | 610 return true; |
| 609 } | 611 } |
| 610 | 612 |
| 611 } // namespace content | 613 } // namespace content |
| OLD | NEW |