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/interactive_test_utils.h" | 5 #include "chrome/test/base/interactive_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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 void ClickOnView(const Browser* browser, ViewID vid) { | 77 void ClickOnView(const Browser* browser, ViewID vid) { |
78 NSWindow* window = browser->window()->GetNativeWindow(); | 78 NSWindow* window = browser->window()->GetNativeWindow(); |
79 DCHECK(window); | 79 DCHECK(window); |
80 NSView* view = view_id_util::GetView(window, vid); | 80 NSView* view = view_id_util::GetView(window, vid); |
81 DCHECK(view); | 81 DCHECK(view); |
82 MoveMouseToNSViewCenterAndPress( | 82 MoveMouseToNSViewCenterAndPress( |
83 view, | 83 view, |
84 ui_controls::LEFT, | 84 ui_controls::LEFT, |
85 ui_controls::DOWN | ui_controls::UP, | 85 ui_controls::DOWN | ui_controls::UP, |
86 base::MessageLoop::QuitClosure()); | 86 base::MessageLoop::QuitWhenIdleClosure()); |
87 content::RunMessageLoop(); | 87 content::RunMessageLoop(); |
88 } | 88 } |
89 | 89 |
90 void FocusView(const Browser* browser, ViewID vid) { | 90 void FocusView(const Browser* browser, ViewID vid) { |
91 NSWindow* window = browser->window()->GetNativeWindow(); | 91 NSWindow* window = browser->window()->GetNativeWindow(); |
92 DCHECK(window); | 92 DCHECK(window); |
93 NSView* view = view_id_util::GetView(window, vid); | 93 NSView* view = view_id_util::GetView(window, vid); |
94 DCHECK(view); | 94 DCHECK(view); |
95 [window makeFirstResponder:view]; | 95 [window makeFirstResponder:view]; |
96 } | 96 } |
(...skipping 23 matching lines...) Expand all Loading... |
120 // events are sent via ui_test_utils::SendKeyPressSync. | 120 // events are sent via ui_test_utils::SendKeyPressSync. |
121 BOOL notification_observed = [async_waiter wait]; | 121 BOOL notification_observed = [async_waiter wait]; |
122 base::RunLoop().RunUntilIdle(); // There may be other events queued. Flush. | 122 base::RunLoop().RunUntilIdle(); // There may be other events queued. Flush. |
123 NSMenu* file_menu = [[[NSApp mainMenu] itemWithTag:IDC_FILE_MENU] submenu]; | 123 NSMenu* file_menu = [[[NSApp mainMenu] itemWithTag:IDC_FILE_MENU] submenu]; |
124 [[file_menu delegate] menuNeedsUpdate:file_menu]; | 124 [[file_menu delegate] menuNeedsUpdate:file_menu]; |
125 | 125 |
126 return !async_waiter || notification_observed; | 126 return !async_waiter || notification_observed; |
127 } | 127 } |
128 | 128 |
129 } // namespace ui_test_utils | 129 } // namespace ui_test_utils |
OLD | NEW |