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

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

Issue 11235048: Test suite that monitors the disposition of JS-created windows based on what (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up html Created 8 years, 2 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 | Annotate | Revision Log
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/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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) {
227 SimulateModifiedMouseClick(web_contents, 0,
228 WebKit::WebMouseEvent::ButtonLeft);
229 }
230
231 void SimulateModifiedMouseClick(WebContents* web_contents, int modifiers,
232 WebKit::WebMouseEvent::Button button) {
227 int x = web_contents->GetView()->GetContainerSize().width() / 2; 233 int x = web_contents->GetView()->GetContainerSize().width() / 2;
228 int y = web_contents->GetView()->GetContainerSize().height() / 2; 234 int y = web_contents->GetView()->GetContainerSize().height() / 2;
229 WebKit::WebMouseEvent mouse_event; 235 WebKit::WebMouseEvent mouse_event;
230 mouse_event.type = WebKit::WebInputEvent::MouseDown; 236 mouse_event.type = WebKit::WebInputEvent::MouseDown;
231 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; 237 mouse_event.button = button;
232 mouse_event.x = x; 238 mouse_event.x = x;
233 mouse_event.y = y; 239 mouse_event.y = y;
240 mouse_event.modifiers = modifiers;
234 // Mac needs globalX/globalY for events to plugins. 241 // Mac needs globalX/globalY for events to plugins.
235 gfx::Rect offset; 242 gfx::Rect offset;
236 web_contents->GetView()->GetContainerBounds(&offset); 243 web_contents->GetView()->GetContainerBounds(&offset);
237 mouse_event.globalX = x + offset.x(); 244 mouse_event.globalX = x + offset.x();
238 mouse_event.globalY = y + offset.y(); 245 mouse_event.globalY = y + offset.y();
239 mouse_event.clickCount = 1; 246 mouse_event.clickCount = 1;
240 web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 247 web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
241 mouse_event.type = WebKit::WebInputEvent::MouseUp; 248 mouse_event.type = WebKit::WebInputEvent::MouseUp;
242 web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 249 web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
243 } 250 }
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 } 609 }
603 // The queue should not be empty, unless we were quit because of a timeout. 610 // The queue should not be empty, unless we were quit because of a timeout.
604 if (message_queue_.empty()) 611 if (message_queue_.empty())
605 return false; 612 return false;
606 if (message) 613 if (message)
607 *message = message_queue_.front(); 614 *message = message_queue_.front();
608 return true; 615 return true;
609 } 616 }
610 617
611 } // namespace content 618 } // namespace content
OLDNEW
« content/public/test/browser_test_utils.h ('K') | « 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