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

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: Fix style nits 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
« 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 "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
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,
227 int modifiers,
228 WebKit::WebMouseEvent::Button button) {
227 int x = web_contents->GetView()->GetContainerSize().width() / 2; 229 int x = web_contents->GetView()->GetContainerSize().width() / 2;
228 int y = web_contents->GetView()->GetContainerSize().height() / 2; 230 int y = web_contents->GetView()->GetContainerSize().height() / 2;
229 WebKit::WebMouseEvent mouse_event; 231 WebKit::WebMouseEvent mouse_event;
230 mouse_event.type = WebKit::WebInputEvent::MouseDown; 232 mouse_event.type = WebKit::WebInputEvent::MouseDown;
231 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; 233 mouse_event.button = button;
232 mouse_event.x = x; 234 mouse_event.x = x;
233 mouse_event.y = y; 235 mouse_event.y = y;
236 mouse_event.modifiers = modifiers;
234 // Mac needs globalX/globalY for events to plugins. 237 // Mac needs globalX/globalY for events to plugins.
235 gfx::Rect offset; 238 gfx::Rect offset;
236 web_contents->GetView()->GetContainerBounds(&offset); 239 web_contents->GetView()->GetContainerBounds(&offset);
237 mouse_event.globalX = x + offset.x(); 240 mouse_event.globalX = x + offset.x();
238 mouse_event.globalY = y + offset.y(); 241 mouse_event.globalY = y + offset.y();
239 mouse_event.clickCount = 1; 242 mouse_event.clickCount = 1;
240 web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 243 web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
241 mouse_event.type = WebKit::WebInputEvent::MouseUp; 244 mouse_event.type = WebKit::WebInputEvent::MouseUp;
242 web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 245 web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
243 } 246 }
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 } 605 }
603 // The queue should not be empty, unless we were quit because of a timeout. 606 // The queue should not be empty, unless we were quit because of a timeout.
604 if (message_queue_.empty()) 607 if (message_queue_.empty())
605 return false; 608 return false;
606 if (message) 609 if (message)
607 *message = message_queue_.front(); 610 *message = message_queue_.front();
608 return true; 611 return true;
609 } 612 }
610 613
611 } // namespace content 614 } // 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