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 "chrome/test/base/ui_test_utils.h" | 5 #include "chrome/test/base/ui_test_utils.h" |
6 | 6 |
7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 void ClickOnView(const Browser* browser, ViewID vid) { | 42 void ClickOnView(const Browser* browser, ViewID vid) { |
43 NSWindow* window = browser->window()->GetNativeWindow(); | 43 NSWindow* window = browser->window()->GetNativeWindow(); |
44 DCHECK(window); | 44 DCHECK(window); |
45 NSView* view = view_id_util::GetView(window, vid); | 45 NSView* view = view_id_util::GetView(window, vid); |
46 DCHECK(view); | 46 DCHECK(view); |
47 MoveMouseToCenterAndPress( | 47 MoveMouseToCenterAndPress( |
48 view, | 48 view, |
49 ui_controls::LEFT, | 49 ui_controls::LEFT, |
50 ui_controls::DOWN | ui_controls::UP, | 50 ui_controls::DOWN | ui_controls::UP, |
51 MessageLoop::QuitClosure()); | 51 MessageLoop::QuitClosure()); |
52 RunMessageLoop(); | 52 content::RunMessageLoop(); |
53 } | 53 } |
54 | 54 |
55 void HideNativeWindow(gfx::NativeWindow window) { | 55 void HideNativeWindow(gfx::NativeWindow window) { |
56 [window orderOut:nil]; | 56 [window orderOut:nil]; |
57 } | 57 } |
58 | 58 |
59 bool ShowAndFocusNativeWindow(gfx::NativeWindow window) { | 59 bool ShowAndFocusNativeWindow(gfx::NativeWindow window) { |
60 // Make sure an unbundled program can get the input focus. | 60 // Make sure an unbundled program can get the input focus. |
61 ProcessSerialNumber psn = { 0, kCurrentProcess }; | 61 ProcessSerialNumber psn = { 0, kCurrentProcess }; |
62 TransformProcessType(&psn,kProcessTransformToForegroundApplication); | 62 TransformProcessType(&psn,kProcessTransformToForegroundApplication); |
(...skipping 21 matching lines...) Expand all Loading... |
84 center = [view convertPoint:center toView:nil]; | 84 center = [view convertPoint:center toView:nil]; |
85 center = [window convertBaseToScreen:center]; | 85 center = [window convertBaseToScreen:center]; |
86 center = NSMakePoint(center.x, [screen frame].size.height - center.y); | 86 center = NSMakePoint(center.x, [screen frame].size.height - center.y); |
87 | 87 |
88 ui_controls::SendMouseMoveNotifyWhenDone( | 88 ui_controls::SendMouseMoveNotifyWhenDone( |
89 center.x, center.y, | 89 center.x, center.y, |
90 base::Bind(&internal::ClickTask, button, state, task)); | 90 base::Bind(&internal::ClickTask, button, state, task)); |
91 } | 91 } |
92 | 92 |
93 } // namespace ui_test_utils | 93 } // namespace ui_test_utils |
OLD | NEW |